Fancybox with Ajax…help
-
I am having an issue that I think others have had, with only vague references made to a fix or the answer that is a best practice with wordpress. This is what I have in my .js file and dont know if I am calling fancybox on success correctly or if I am way off.
jQuery(document).ready(function($) { $('.tax-filter').click( function(event) { // Prevent defualt opening tag page if (event.preventDefault) { event.preventDefault(); } else { event.returnValue = false; } // Get tag slug from title attirbute var selecetd_taxonomy = $(this).attr('title'); $('.tagged-posts').fadeOut(); data = { action: 'filter_posts', afp_nonce: afp_vars.afp_nonce, taxonomy: selecetd_taxonomy, }; $.ajax({ type: 'post', dataType: 'json', url: afp_vars.afp_ajax_url, data: data, success: function( data, textStatus, XMLHttpRequest ) { $('.tagged-posts').html( data ); $('.tagged-posts').fadeIn(); $('.video-post').fancybox(); console.log( textStatus ); console.log( XMLHttpRequest ); }, error: function( MLHttpRequest, textStatus, errorThrown ) { console.log( MLHttpRequest ); console.log( textStatus ); console.log( errorThrown ); $('.tagged-posts').html( 'No posts found' ); $('.tagged-posts').fadeIn(); } }) }); });
I have the posts being called and the fancybox work perfectly on the original page, but when dynamically loading the content it is not being recognized.
Any help would be greatly appreciated.
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘Fancybox with Ajax…help’ is closed to new replies.