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 7129271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:13:30+00:00 2026-05-28T11:13:30+00:00

EDIT : would help if my tags were closed…no improvement alas. What I’m trying

  • 0

EDIT : would help if my tags were closed…no improvement alas.

What I’m trying to build is relatively simple. A slot machine-like interface with “rolling” images that eventually will slow down and stop. I’m using jQuery’s .slideUp() function to do so, and it works well when applied to a single panel. But when applied to a second or third, the animation start acting weird.

Try this demo to see what I mean : http://bit.ly/wtiq36

Anyone know what’s going on? The technique I’m using to simulate the animation is pretty straightforward, I just pile all the images onto the other, and swap the highest z-index for the lowest z-index-1 to put it back at the end of the stack once the slideUp() is finished.

(p.s. I am aware this loops infinitely, that part is not done yet :))

Here’s the important code (html & js), or just check the source on that link for everything.

HTML

<div class="panel one">
        <ul>
            <li class="item" style="z-index:1"><img src="images/img1.jpg" /></li>
            <li class="item" style="z-index:2"><img src="images/img2.jpg" /></li>
            <li class="item" style="z-index:3"><img src="images/img3.jpg" /></li>
        </ul>
    </div>

    <div class="panel two">
        <ul>
            <li class="item" style="z-index:1"><img src="images/img1.jpg" /></li>
            <li class="item" style="z-index:2"><img src="images/img2.jpg" /></li>
            <li class="item" style="z-index:3"><img src="images/img3.jpg" /></li>
        </ul>
    </div>

    <div class="panel three">
        <ul>
            <li class="item" style="z-index:1"><img src="images/img1.jpg" /></li>
            <li class="item" style="z-index:2"><img src="images/img2.jpg" /></li>
            <li class="item" style="z-index:3"><img src="images/img3.jpg" /></li>
        </ul>
    </div>

And JS

function testit(n){
    $(".panel."+n).each(function() {
        secondclass = $(this).attr('class').split(' ')[1]
        div = ("."+secondclass+" ul li")
        if(secondclass != "stats"){
            flip(div)
        }
    })
}
function flip(div){
    highest = gethighZ(div)[1]
    highest.slideUp(400,'linear',function(){
        lowestZ = getlowZ(div)[0]
        highest.css("z-index",lowestZ-1)
        highest.show()
        flip(div)
    })
}


//these 2 functions just return highest/lowest zindex divs
function gethighZ(div){
    var index = -999999999999
    var result = Array()
    $(div).each(function() {
        var current = parseInt($(this).css("zIndex"), 10)
        if(current > index) {
            result[0] = current
            result[1] = $(this)
            index = current
        }

    });
    return result
}

function getlowZ(div){
    var index = 99999999999999
    var result = Array()
    $(div).each(function() {
        var current = parseInt($(this).css("zIndex"), 10)
        if(current < index) {
            result[0] = current
            result[1] = $(this)
            index = current
        }

    });
    return result
}
  • 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-05-28T11:13:31+00:00Added an answer on May 28, 2026 at 11:13 am

    Try to stop all animations before:

    highest.stop().slideUp(400,'linear',function(){
        lowestZ = getlowZ(div)[0]
        highest.css("z-index",lowestZ-1)
        highest.show()
        flip(div)
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT : Scroll down to see the updated code. I would like to build
I'm trying edit a plugin which I use to add meta open graph tags
I would like to edit matlab scripts in two cases (1) In matlab Command
I would like to place an edit control (WC_EDIT) on a static control (WC_STATIC).
**EDIT: There are several options below that would work. Please vote/comment according to your
Edit: Appended or LDAP to question title to indicate that I would be fine
How would I change the below script to edit the original file instead of
I would like to know how I could edit mp3 files on the server
I would like to write a script which will edit multiple XML files, I
I would like the user to be able to edit the title of the

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.