1

I've been trying to get this little project I'm doing finished, but for some reason it is not properly working.

The issue is when I first visit the page and click the first link that appears in the main section it displays the popup box as wanted. Now when I click another day, for instance sunday and try to click the first link it doesn't do anything. And if I click back to Saturday the first link also doesn't do anything anymore.

It seems something is not properly activating or maybe a command is overwriting and not allowing it to work like it does when you first hit the landing page. I'm sorry if this is confusing but any help would be much appreciated.

The website is pouronline.com that's where i do all my testing.

Thank you

2 Answers 2

2

You need to use the .live function.

So in your popup.js replace

 $('a.poplight[href^=#]').click(function() {

with

 $('a.poplight[href^=#]').live('click',function() {
Sign up to request clarification or add additional context in comments.

Comments

1

Swap this:

$('a.poplight[href^=#]').click(function()

with this:

$('a.poplight[href^=#]').live('click',function()

You need to use a future-proof event observer because once you reload those anchors by changing the day in this case, the initial binding is lost. live() means to apply the binding to currently existing nodes as well as nodes that are added to the DOM at a later time.

1 Comment

You are the freaking man! Thank you for solving this issue. I'm new to jquery and this is a learning experience for me. So when you put .live('click',function() it's essentially the same thing but with .live being for anything that activates a change?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.