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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:03:16+00:00 2026-05-17T22:03:16+00:00

I have a stack of cards. They are stacked so each one has about

  • 0

I have a stack of cards. They are stacked so each one has about a centimetre at the bottom visible. What I want, is when a card is clicked it moves to the right, then gets sorted to the top and moves to the left back onto the pile. I then wish to trigger a page change (to the page that’s represented by the card).

How would I do this through JQuery? I’m still at a basic level with this language.

<style>
#cardStack{
    height: 700px;
    width: 400px;   
    overflow:visible;
}
#cardStack ul{
    display:inline;
}
#cardStack li{
    z-index:auto;
}
.top{
    margin-top:-670px;
    z-index:1;

}
.middle{
    margin-top:-670px;
    z-index:2;
}
.bottom{
    margin-top:100px;
    z-index:3;
}
</style>
</head>

<body><br /><br />
<div id="cardStack">
<ul>
    <li class="bottom"><img src="images/cardA.png" /></li>
    <li class="middle"><img src="images/card6.png" /></li>
    <li class="top"><img src="images/card8.png" /></li>
</ul>
</div>

I know there’s an animate function, but how would I initiate this on a click?

EDIT: Added more code above

  • 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-17T22:03:16+00:00Added an answer on May 17, 2026 at 10:03 pm

    for the hash change use ben alman’s BBQ plugin
    tried your code at jsbin
    but because the link to the cards is missing the HTML doesn’t render right
    if you put here a working jsbin sample – helping you will be mush easier

    concerning the animations: if you layout the Li’s to have an absolute position, you can move them around freely,
    so you can animate them to the left and then animate back and then change the z-index to put it on the top

    [edit]
    So.. here is a link to a quick solution:
    you had some problems with the animations code, + better to change the position and not the marign

    for ref the code:

    $('#cardStack img').click(function () 
    {
           var img = $(this);
           img.animate({left: '+=50px'},200,function() 
              {
                    img.animate({left: '-=50px'},200,function()
                         {
                           img.parent().prependTo($("ul"));
                           arrengeClasses();
                         });
              });
    });
    
    function arrengeClasses()
    {
        var allListItems = $("#cardStack ul li");
        for(var i=0;i<allListItems.length;++i)
        {
          allListItems.eq(i).removeClass().addClass("pos" + i);
        }
    }
    
    • and changed the css a bit:

       #cardStack li img{
          position:absolute;
           top:0px;
           left:0px;
          }
       .pos2{
          z-index:1;
          margin-top:100px;
       }
       .pos1{
          z-index:2;
          margin-top:50px;
       }
       .pos0{
         z-index:3;
       }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have cards in my web app that each one of them has a
i have a stack of messages in database table. i want to send these
I have a stack which contains some integer data. I want to find out
I am working on a card game iPhone app and have a question about
I'm creating a game that uses cards. I have an AppController class with one
One of my classes has suddenly started to complain about it being non-serializable. I
In my cardgame-project, I simulate a cardpile with a stack. Each card of the
I have stack panel with custom controls in it. I attach standard MouseDragElementBehavior to
I have stack panel with custom controls in it. User can add or remove
I have a stack panel for which AllowDrop property is true and I have

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.