browserstate / ajaxify

Ajaxify your entire website instantly with this simple drop-in script using the HTML5 History API with History.js and jQuery ScrollTo.
602 stars 94 forks source link

No-ajaxy not working for dynamically created content. #31

Open sonill opened 10 years ago

sonill commented 10 years ago

I have a ".no-ajaxy" on dynamically created content but ajaxify-html5 does not seem to respect that. Is there any workaround?

function do_something(){
$('.gallery-icon a').addClass('fancybox no-ajaxy').attr('rel', 'gallery');
}

above function is executed after every ajax requests. I can verify that above class has been added into the element by looking in firebug. But ajaxify-html5 seems to load that content with ajax too. How can i make sure '.no-ajaxy' class does work like expected.

Nodws commented 8 years ago

yeah, plugin is a pain, better to write your own

dalecooper commented 7 years ago

I know this is old, but I was facing the same issue and easily solved it by replacing line 149 to :

$content.html(contentHtml);
$content.find('a[href*=".jpg"], a[href*="jpeg"], a[href*=".png"], a[href*=".gif"]').addClass('no-ajaxy fancybox').fancybox();
$content.ajaxify().css('opacity',100).show();

So that all links pointing to an image will be "un-ajaxified" and "fancyboxied". Hope that helps someone in the future.