WordPress: Load JavaScript / JQuery after dynamic page content loads in div -


i'm trying create one-page wordpress based site page content being loaded div onclick. however, since javascript has been loaded before page content loaded, scripts don't work.

the temp site here: http://upsilon.lunariffic.com/~swstr0/

if click on clients-->who work you'll see problem. logo slider doesn't slide. no arrows, , depending on browser, links don't work.

probably because script loaded? http://upsilon.lunariffic.com/~swstr0/wp-content/plugins/logo-slider/jquery.cycle.all.min.js?ver=3.9.1

here's code i'm using div slide down (or up) , load page content:

<script type="text/javascript"> jquery(function($) { $("li.btn-slide a").on('click', function(e){     e.preventdefault();      var post_url = $(this).attr("href");     var post_id  = $(this).attr("rel");      $("#page-con").html("loading...")                   .load(post_url, function() { // content loaded callback          var pageconheight = $("#page-con").height();  // find height of content inside #panel          $("#panel").animate({height: pageconheight}, "slow"); // animate height of #panel      }); }); 

});

when run slider script, applies slider effect existing elements. if put new content in page, need reapply script.

after line:

$("#panel").animate({height: pageconheight}, "slow"); // animate height of #panel 

add

$('#idofyourloadedcontent').cycle(); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -