This post has been edited by jpwd: 21 January 2012 - 03:44 PM
Page 1 of 1
Quick Jquery help required Trying to rehide a shown element
#1
Posted 21 January 2012 - 03:43 PM
Hello, I'm new to jquery and want to get a basic working example onto a website I have made. Heres's the website and page in question-beauty-gems. Using a beginners tutorial I have made a basic drop down from the Click More Information tag. However I would like the information shown to be hidden again when the user clicks anywhere on the page. I have tried a few things but to no avail! Thanks.
#2
Posted 21 January 2012 - 06:35 PM
jpwd, on 21 January 2012 - 03:43 PM, said:
Hello, I'm new to jquery and want to get a basic working example onto a website I have made. Heres's the website and page in question-beauty-gems. Using a beginners tutorial I have made a basic drop down from the Click More Information tag. However I would like the information shown to be hidden again when the user clicks anywhere on the page. I have tried a few things but to no avail! Thanks.
Not entirely what you want, but I think this is better in my opinion.
Just change .slideDown to .slideToggle and then maybe add a +/- to the link. This will show and hide for you.
#3
Posted 21 January 2012 - 07:03 PM
You could attach a click event to the rest of the page with the not() selector.
#4
Posted 21 January 2012 - 07:56 PM
jonnyhocks, on 21 January 2012 - 06:35 PM, said:
Not entirely what you want, but I think this is better in my opinion.
Just change .slideDown to .slideToggle and then maybe add a +/- to the link. This will show and hide for you.
Just change .slideDown to .slideToggle and then maybe add a +/- to the link. This will show and hide for you.
Funnily enough I have just seen this method on W3Schools, I think I will implement it for the time being, with alternate arrows to show the information and the hide the information. Thank you very much.
How would I go about coding the click not()selector? As I think long term that would be the best option.
I'm doing this the wrong way really, implementing code before learning it!
- ← having problems getting to grips with javascript / xml
- CSS, XHTML/HTML & JavaScript
- Which Layout? →
Share this topic:
Page 1 of 1
Help















