Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8504609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:04:59+00:00 2026-06-11T02:04:59+00:00

I have a cascade animation in jQuery. The problem is that: into the div

  • 0

I have a cascade animation in jQuery. The problem is that: into the div I have two different element with two different class: linguetta_small, linguetta.
If the element to aniamte has class “linguetta” have to be a margin of 5px instead if the class is linguetta_small the margin left have to be 40px. How can I make that?
This is my html

<div id="linguetta_next">
    <div class="linguetta" id="linguetta_next1 moved" style="margin-left:100%;">
        <p class="tit_linguetta">azienda</p>
    </div>
    <div class="linguetta_small" id="linguetta_next2 moved" style="margin-left:100%; margin-top:10px; background:#b0f271;">
        <p class="tit_linguetta_small">staff</p>
    </div>
    <div class="linguetta_small" id="linguetta_next3 moved" style="margin-left:100%; margin-top:10px; background:#0a5a0a;">
        <p class="tit_linguetta_small" style="color:#fff;">risorse umane</p>
     </div>
 </div>

And this is my jQuery code:

function movePageCenter(id, old_id) {
    var margin = "1%";
    $("#linguetta_next div").each(function(i) {
        var el = $(this);
        setTimeout(function() {
            el.animate({
                marginLeft: margin
            }, 400, function() {
                if (el.next(".linguetta_small").hasClass('linguetta_small')) {
                    margin = "40px";
                }
                else {
                    if (el.next(".linguetta").hasClass('linguetta')) {
                        margin = "5px";
                    }
                }
            });
        }, i * 200);
    });

});
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:05:01+00:00Added an answer on June 11, 2026 at 2:05 am

    With each() we loop through each elemeat that fits our selection. You don’t have to consider the element that is next in line to be animated, you treat every element seperately.

    So with every element we check which class it has and set the margin accordingly.

    Also jQuery has a very nice function called delay, which is much easier to use than the setTimeout function.

    $("#linguetta_next div").each(function(i) {
    
           var $el = $(this);
           var margin;   
    
           if ($el.hasClass('linguetta_small')) {
               margin = 40;
            } else {
               margin = 5;
           }
    
    
            $el.delay( i * 200).animate({ 'margin-left': margin }, 400);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables without any cascade deleting. I want to delete parent object
If i have a @OneToMany relationship with @Cascade(CascadeType.SAVE_UPDATE) as follows public class One {
I have seen many php scripts in which you can cascade class method to
i have relationship: // In A.java class @OneToMany(mappedBy=a, fetch=FetchType.LAZY) @Cascade(CascadeType.SAVE_UPDATE) private List<B> bList; //
I am using haar cascade for profile face, but i have noticed that it
I have a class say: ClassA which has a collection of ClassB @OneToMany(cascade =
I have a problem with multiple cascade path error. Here are my tables: Table
i have a oneToMany and ManyToOne mapping in my models: class User @OneToMany (cascade
i have these Pojos: public class ParticipantPojo implements Serializable ..... @OneToMany(mappedBy = participant, cascade
I have a problem where i need a cascade on multiple foreign keys pointing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.