Welcome to the Treehouse Community
Looking to learn something new?
Problems on a site with JQuery
Hi I have inherited some code and I am a bit stuck on a JQuery question.
The script on the attached JSFiddle is supposed to make the boxes at the bottom when click load their corresponding image on top of what is already there - click it again and it disappears.
The site is http://www.thegeorgebarton.co.uk/
Sean Templeton12,983 Points
You have a couple of issues. First off, there is a syntax error because you have a trailing
.live is deprecated. Instead, use
.on with delegation. This is done by selecting a parent element, calling the "on" function. The first parameter is the event, the second the selector of the element you want to attache the event to, and the third the function to call.
Finally, you didn't have jQuery included.
Check this fiddle out to see the working changes: http://jsfiddle.net/Be4Fw/7/
Thanks for that, unfortunately that only allows you one click and then stops working. Do you know how to make it so I can click on each box and it have the enlarge pop up.