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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:06:12+00:00 2026-05-24T09:06:12+00:00

I’m a JS and jQuery newb so please bear with me. I’ve got this

  • 0

I’m a JS and jQuery newb so please bear with me. I’ve got this script working somewhat but it doesn’t do exactly what I want it to do and I can’t figure it out. The basic idea is that I click a link and it opens a div using slideToggle. The tricky part is closing a previously opened div before opening a new one, the best that I’ve been able to do is to hide the previous div. Trying to toggle the previous div has not worked presumably because I’m not targeting the div specifically but rather telling it to close all divs before opening the new one. Another issue I’ve run into is links on the same page seem to become disabled, this appears to be due to the “return false” command however I don’t know how to keep the page from scrolling to the top when I click the slide link if I don’t use that command. Thanks for any help.

Here is what I’m working with: http://jsfiddle.net/NkX2Z/

  • 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-24T09:06:12+00:00Added an answer on May 24, 2026 at 9:06 am

    You have to do some more controls in order to make the external link work.

    here is my solution, actually i don’t know if it is what you are looking for but maybe it could help you

    http://jsfiddle.net/gb9M7/1/

    if($("#"+$(this).attr("class")).length && !$("#"+$(this).attr("class")).is(':visible'))
    

    the condition here checks if the div which correspond to the a element exists and, if so, it checks if that div is not already opened.
    When the state of the page meets those constraint than the if block is executed.

    UPDATE 1

    here is the code with slide time:

    http://jsfiddle.net/gb9M7/2/

    var time = 1200;
    .slideUp(time);
    .slideDown(time);
    

    UPDATE 2

    and here is the improved version which prevend a link to '#' from scrolling the page:

    http://jsfiddle.net/gb9M7/3/

    if($(this).attr('href') == '#')
       return false;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I want to construct a data frame in an Rcpp function, but when I
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

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.