Home › Forums › JavaScript › All Ajax Theme – Js into pages problem
- This topic is empty.
-
AuthorPosts
-
November 10, 2011 at 11:47 am #35118ChristopheZFMember
Hi Everybody ;)
I’ve watched the How to AJAXing a WP Theme screencast , and downloaded the updated theme.
I’ve extracted and copied the scripts in order to use them into a WP theme that I’m working on, and everything is allright. However, I’ve got an issue (yep, it won’t be great otherwise…) with some template pages using Js inside.
I registered all my scripts in the functions.php, and they load well, but nothing happens when pages are loaded through the AJAX methods. I mean, the scripts are well loaded in the header, but it’s like template pages are just loading without using them.
To be more accurate: I’m using jPlayer, and jQuery form plugin for example. Any of those work when the page is loaded through AJAX.
Is there any AJAX/Js tricks I forgot?
February 27, 2012 at 11:02 am #97584RicsMember+1
I’ve this problem using jCarousel. I’m trying to solve this problem in a someway by searching on the web.February 27, 2012 at 2:40 pm #97604KermetMemberProbably they rely on document.ready function, or something like that.
If they load into the #content’s ajax-ed area you probably have to change that logic a bit…just a guess.February 27, 2012 at 2:55 pm #97605RicsMemberI was using Sorgalla’s jCarousel and I’ve solved in a way, but i’m not sure that’s nice and clean as i’m not an ajax master…i was inspired from a stackoverflow thread…
I’ve put a delayed ajax request in the footer that request a js file that contain the jCarousel call:
slide-start.js is simply the jquery call for the jCarousel script:
Probably this could be done in a nice or different way, i’m sure.
BTW including the call inside the #content don’t work.February 27, 2012 at 3:08 pm #97610RicsMemberWell, i’ve also to admit that the solution works only on the homepage load, then when going to a menu item to another one the ajax call isn’t done.
March 16, 2012 at 4:40 pm #99265RicsMemberOk, i didn’t had so much time in the last month to investigate the problem, but this evening i’ve decide to spend a bit of time into it and that’s a shame for me, the solution was so damn simple:
put the jQuery calls inside the “$variablename.load(base + event.value + ‘ #inside’, function() { //jQuery calls here });”I don’t know if i’m allowed to report portions of the “allajax.js” code, so i’ve wrote just a small chunk.
If you have the template you can find that code portion inside the script.Now it’s working flawlessy!
-
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.