abtecas — 2013-09-09T10:35:11-04:00 — #1
I'm trying to figure out why my script seems to be working in reverse. I have a page where there are hidden elements that will be shown when an image is clicked. The content should be hidden when the page is loaded, and only shown when the button is clicked. However, the page is loading with the content shown, and the images that are clicked actually hides the content,
The page is http://scope-stage.scholastic.com/issues/09_01_13/Narrative-Nonfiction and there are headings on the lower right hand side with images next to them (circles with "+" signs in them) One of those are "Complexity Factors", and the grey sub headings under it is what should be hidden.
My jQuery script is:
return false; });
where .hiddenComplexity is the div that has the content that should be hidden under "Complexity Factors", but it is showing instead, and hides when clicked (the opposite as intended). .expandingBtn is the name of the DIV that is clicked to show the hidden content. What am I doing wrong?
jeff_mott — 2013-09-09T11:05:07-04:00 — #2
Perhaps try calling hide() instead of show().
Also, make sure all the DIVs have the class you expect them to have ("hiddenComplexity", "hidden", etc).
abtecas — 2013-09-09T12:35:41-04:00 — #3
[QUOTE=Jeff Mott;5565477]Perhaps try calling hide() instead of show().
Yes indeed. However, what about when I want them to be shown when the image is clicked?
jeff_mott — 2013-09-09T13:06:58-04:00 — #4
The slideToggle() should already do that (assuming you've made sure that all the DIVs have the class you expect them to have ("hiddenComplexity", "hidden", etc)).
abtecas — 2013-09-09T16:15:54-04:00 — #5
It does, but it's working backwards. The page loads with the div (.hiddenComplexity) shown, when it's supposed to be hidden, and hides when I click the image. It should be hidden on page load and then shown when I click. Eventually I'll have to have the expandBtn.png change to a circle with a minus sign on it, but that's another issue. Right now I just want to figure out why my script is working backwards
Thanks for taking a look
thetenfold — 2013-09-09T20:45:53-04:00 — #6
I see no div with the class "hiddenComplexity".
abtecas — 2013-09-10T12:48:09-04:00 — #7
Sorry, it's there now. Now the div hides as it should, however, the script will not toggle it.