Solved

JQuery slideToggle() problem

Posted on 2014-03-30
4
623 Views
Last Modified: 2014-03-30
Hi all.
I'm struggling with a couple of jquery stupid issues (I'm sure they are stupid!)

Please, refer to http://dev.delphicoding.com/appcdw_present.php

Do you see the feature list with rows of two different gray hues? Immediately before the list is a h3 tag which I treat as a button:

<h3 id="btnFeatures">CDW Features:</h3>
<ul id="featuresList">
	<li>Two <b>backup</b> types available: Basic and Advanced</li>
	<li>Multi-threaded <b>backup</b> and <b>restore</b> processes: less time for best results</li>
...

Open in new window


Here the jquery stuff:

	$('#btnFeatures').click(function()
        {
 		$('#featuresList').slideToggle('slow');
	});

Open in new window


Well, when you click the 'button', featuresList slideUp and then slideDown immediately!

Any idea to light up my poor mind?

This question is related to http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/Q_28400699.html

Thanks to all
0
Comment
Question by:Marco Gasi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 24

Expert Comment

by:mankowitz
ID: 39964816
My guess is that you are assigning the click handler in two separate locations. You may have to look though your code to find out where.

Check by typing this in the console
$("#btnFeatures").data('events')
0
 
LVL 24

Accepted Solution

by:
mankowitz earned 500 total points
ID: 39964828
Use F12 on your page. When  you do, you see that jscript is called twice, once by the php page and then once by jquery.js. That is unusual. Try loading jquery and jquery-ui before loading any of your own scripts and see if that makes a difference.
0
 
LVL 31

Author Comment

by:Marco Gasi
ID: 39964856
Hi mankowitz, thanks for your reply.

I followed your suggestion and though I'm not able to read the source of calls to the event (I don't know how you can say one is called by the php page and one by the js script), your input kade me look in the right direction.

The problem has been fixed moving all link to external javascript files in the head section. So, as often happens to me, when I try to speed up my pages foolowing Google suggetions, I end breaking them or partially or totally!

Thank you
0
 
LVL 31

Author Closing Comment

by:Marco Gasi
ID: 39964857
Thanks
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question