Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

this is the code I use to call ajax posts in the same page. It's works fine but when the post is load the slideshow in the post (add via short code) is not showing....

the ajax call

  jQuery('#menu-profilo > li > a').click(function(event){

            //This keeps the href from reloading the page
            event.preventDefault();

            //grab the page link

            var page = jQuery(this).attr('href');

            jQuery('#slideshow').html ('<div id="loading"><p>loading</p></div>')
            //use the grabbed link in the load function
            .load(page+' .post_content').fadeIn(2000)


          });

This is the post load in ajax :

https://www.dropbox.com/s/za0jwx7sdm2z6zx/post.jpg

the post load normally (no ajax call) works fine.

The problem is the jquery plugin royalslider ( or other plugin, is the same) that seems not working.

here firebug image: https://www.dropbox.com/s/iui14sxqm4xwa1d/post2.jpg

the white space is the the royal slider section....

How Can I fix this? I mean when I load a post via ajax call to show the post and the jquery plugin...

share|improve this question
    
You are most likely getting a Javascript error somewhere. Something in one of those scripts is failing, or you have a conflict. You have FireBug installed already, which is good. Enable the console part of FireBug and load the page. Do you get any errors? If so, what are they? –  s_ha_dum Oct 17 '12 at 13:46
    
Hey Thanks for your time and reply! Ther're non errors in firebug console... –  user13401 Oct 17 '12 at 14:18
add comment

1 Answer

When you load a page that contains a normal static post, there is some JavaScript that is called on page load to instantiate your slider. Something like:

jQuery(document).ready(function($){
    $('.sliders').someSliderScript();
});

This finds all of the elements that should have a slider applied and runs all the necessary code to set it up and make it all work.

When you load content via AJAX, that code has already run and won't automagically apply the slider to your newly loaded content. After your AJAX content is added to the page, any JavaScript manipulation of that content has to be called again.

share|improve this answer
    
thanks for suggestion but doesn't –  user13401 Oct 17 '12 at 16:04
    
thanks for suggestion but doesn't works, I try to insert in the single post page but nothing happen.. –  user13401 Oct 17 '12 at 16:06
    
what doesn't work exactly? please clarify what you've tried to do and add it to your question. the above code is not a copy/paste solution, just an example. you will have to find the code which instantiates your slider and add it to your AJAX script –  Milo Oct 17 '12 at 16:52
    
oh yes , I know the code is not a coop/past solution...I don't know where exactly I have to put this code in my ajax call –  user13401 Oct 18 '12 at 9:55
    
it would go in the complete callback of the load function. see jQuery's documentation for load –  Milo Oct 18 '12 at 15:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.