Home › Forums › JavaScript › Make exception for some internal links in Chris ALL AJAX WordPress theme.
- This topic is empty.
-
AuthorPosts
-
August 7, 2011 at 1:22 pm #33820
noahgelman
ParticipantSome things like click events and lightbox’s don’t work since they are internal links. How can I make an exception for these things in regards to the ALL AJAX WordPress theme?
August 7, 2011 at 3:56 pm #84594noahgelman
ParticipantThat doesn’t make any sense. Do you know what js the theme uses?
August 7, 2011 at 4:35 pm #84595clokey2k
ParticipantYou could add a class to the links that you do not wish to be AJAX’d, and change the ‘allajax.js’ to include a ‘.not()’ statement?
$('a:urlInternal').not('.myspeciallinks').live('click', function(e) { ... });
***EDIT*** I have also just read your other post: 13068.
You’ve tried the ‘.not()’ function. No further ideas from me then! :-)
I believe the issue @BoringCode is trying to address is already dealt with by the ‘.live’ function. The only time that you would need to readdress ‘click’ functions is if there is an ‘iframe’ in the lightbox.
August 7, 2011 at 5:59 pm #84597noahgelman
Participant@clokey2k, that was something I tried, without success. I tried a few things along side that.
I did however find out the problem.
I found this article by Chris: https://css-tricks.com/9738-just-one-of-those-things-you-need-to-understand-about-javascript/
I now know what BoringCode was trying to say and I want to apologize for being a bit rude to him. When he said I needed to initialize the click in the AJAX call he really meant I needed to RE-initialize the click function so I misinterpreted what he was trying to say.
That being said, I thought I had been reinitializing it. I tried using .live() and .delegate() to re-establish the clicks as well and neither worked. For whatever reason I had to recall the entire function that sets up the gallery. I suppose there’s important code that needs the DOM already set before calling it so just replacing the clicking wasn’t enough.
Thanks for the help BoringCode and clokey2k.
Sorry again BoringCode
December 15, 2011 at 4:05 pm #92855safetyjon
Membernoah-
i’m running into a similar problem with using jquery with the allajax theme, thought you might be able to elaborate on your solution.i’ve implemented a slideshow on individual pages and it works if i hit the url exactly (www.site.com/pagetitle), but the jquery bits arent happy with the ajax’d url (www.site.com/#/pagetitle).
can you provide a bit more detail into how you recalled the js function?
thanks!
jonDecember 15, 2011 at 8:47 pm #92869noahgelman
ParticipantSure, no problem. I added the links to the ‘removed list’ (like in clokey’s example) and then I the changed all the initiallizing clicks in me plugin’s code from:
$("a").click(function(e) {to
$("a").live('click', function(e) {
and that fixed the issue. If you post your code or tell me what slider you’re using I can give a more detailed answer on how to fix your code to work with AJAX
December 15, 2011 at 9:28 pm #92871safetyjon
Memberafter pondering a bit more, the issue seems related but the cause might be different. i’m using the Image Slider plugin from TheThe Fly.
here’s a screenshot of what’s happening. the slideshow window div is created and appears, but the loading bar stays persistent. and, as you can see, the thumbnails are displaying correctly, though there’s no click action.
if i remove the ajax functionality entirely, the slideshow works exactly as intended. so, it’s definitely a related issue, but not quite the same.
jon
December 16, 2011 at 6:56 pm #92932noahgelman
Participanthmmm, I see. same kind of issue, different cause.
Can you post a link?
December 17, 2011 at 9:38 am #92955safetyjon
Memberhere’s the link to a test setup. currently, the only page that has the TheThe Fly Image Slider loaded into it is the “photographers” page. as you can see, if you hit http://awesomesnack.com/photographers/ directly, the slideshow works as expected. if you go the root url and click on the photographers link, you get the spins.
-
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.