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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:18:42+00:00 2026-06-02T08:18:42+00:00

I have a portfolio itemlist. When I click on specific, its related div slidesDown

  • 0

I have a portfolio itemlist. When I click on specific, its related div slidesDown and you can close (slideUp) by clicking on close link.
Works fine, but the events double fires when clicking on the the other items, so it slidesUp and Down twice, because of the classname relations?
I’m using index() to grap the elements and therefore giving the divs ID’s by 0,1,2,3,4,5,6….

Can someone explain a good workaround to this or a better solution?

HTML Markup example:

<div style="display:none;" id="0" class="sliderwrapper">
   <div class="close"> <a href="#" title="Close"> Close </a></div>
   //SINGLE PORTFOLIO ITEM CONTENT
</div>

<div style="display:none;" id="1" class="sliderwrapper">
   <div class="close"> <a href="#" title="Close"> Close </a></div>
   //SINGLE PORTFOLIO ITEM CONTENT
</div>

<div style="display:none;" id="2" class="sliderwrapper">
   <div class="close"> <a href="#" title="Close"> Close </a></div>
   //SINGLE PORTFOLIO ITEM CONTENT
</div>

JS:

(function(){

    $('.close').on('click', function(){
      $('.sliderwrapper').slideUp(800);
    });

    $('.singleitems ul li').on('click', function(){
      var index = $(this).index();
      $('.sliderwrapper').slideUp(800, function(){

          $('#' + index).slideDown(800);
      });

    });

})();
  • 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-02T08:18:43+00:00Added an answer on June 2, 2026 at 8:18 am

    If you just change the slideDown from being a callback function, it will only be called once.

    this code prevents the animations from overlapping:

    $(document).ready(function() {
        var selected = false;
        $('.close').on('click', function() {
            $(this).parent('.sliderwrapper').slideUp(800);
            selected = false;
        });
    
        $('.singleitems ul li').live('click', function() {
            var index = $(this).index();
    
            if(!selected) {
                $("#" + index).slideDown(800);
                selected = true;
            } else {
                $(".sliderwrapper").filter(":visible").slideUp(800, function() {
                    $("#" + index).filter(":hidden").slideDown(800);
                });
            }
        });
    });​
    ​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On my portfolio page I have this setup: <div id=portfolio> <ul id=sites> <li> <h3><a
I have a bunch of portfolio items sorted as tabs on this page. Link
I have the following link structure for my portfolio: <?php echo $this->Html->link($post['Portfolio']['title'], array('controller' =>
I have the following link: <?php echo $this->Html->link($post['Portfolio']['title'], array('controller' => 'portfolio', 'action' => 'view',
I have a portfolio page which you can select a project and it will
I have a MagazineBundle which in one of its Twig templates has path('portfolio') ,
I have a problem with a simple anchor problem... Portfolio_view.php <div id=site-name> <a href=#portfolio>Go
Basically, have a portfolio site I'm working on, with upwards of 15 pieces in
Live site. Ideally, between border-top and border-bottom, I'd like to have 3 portfolio thumbnails,
I have created my Portfolio and put there a Google+ button. The page is

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.