Grow your CSS skills. Land your dream job.

Make exception for some internal links in Chris ALL AJAX WordPress theme.

  • # August 7, 2011 at 1:22 pm

    Some 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 1:41 pm

    You don’t need to make an exception, what you need to do is initialize your click events inside the AJAX function.

    # August 7, 2011 at 3:56 pm

    That doesn’t make any sense. Do you know what js the theme uses?

    # August 7, 2011 at 4:35 pm

    You 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

    @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: http://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

    noah-
    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!
    jon

    # December 15, 2011 at 8:47 pm

    Sure, 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

    after 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

    hmmm, I see. same kind of issue, different cause.

    Can you post a link?

    # December 17, 2011 at 9:38 am

    here’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.

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".