Triggering jQuery after page has loaded
# November 23, 2012 at 10:26 am
I’ve been trying to figure this out for a while but with no luck.
I’ve got an [html file](http://orchidaberdeen.com/ “”) that loads an [external html](http://orchidaberdeen.com/6_toggle/1.html “”) file and within that external html file is some jQuery that i need to work.
The problem appears to be that my original file loads the jQuery but when the external page gets loaded it doesn’t trigger the jQuery from the original file, thus not working.
I’ve tried the [get.Script](http://api.jquery.com/jQuery.getScript/ “”) but that doesn’t seem to work.
Hoping someone would have some pointers?# November 23, 2012 at 11:19 am
I think an example would be best in this situation for people to see what you are working with.
Is the JS that you are trying to have run wrapped in an anonymous function?
why cant you just use the JS from the external in your main page, or both?
Why not make that JS external and call it in from both?
This is why an example would help you possibly get some narrower answers.# November 23, 2012 at 11:45 am
@JohnMotylJr im actually meaning the gallery section on the main site, when you click on the circles the page expands open to reveal thumb nails. The thumb nail page is an external html file that is stored in a folder called **6_toggle** and is getting loaded into the index.html file by this,
But this function doesn’t seem to like to load the jQuery from its external page.
So i’m just trying to find a workaround that will re-trigger the jQuery so the thumbnails display a lightbox effect that i’ve got set up.# November 23, 2012 at 1:53 pm
@CameronDuthie : If you’r loading another html page inside your first one then try to target it with js from the second, im not really sure if the secondary js will pick up on the DOM. Have you tried just putting that code from your second html file into an anonymous function on your main page?
Hmm, actually, are you referring to the light box script?
Try loading all that into your main html page.# November 23, 2012 at 5:47 pm
@JohnMotylJr Thank you for you help man, but i’ve actually tried all those suggestions. Yeah you got it, it’s the lightbox script i’m trying to implement.
No matter where i put the reference the jquery just doesn’t seem to want to load/trigger from the second html file.
You must be logged in to reply to this topic.