$(document).ready(function(cycle) { // run the code in the markup! $('#image pre code').each(function() { eval($(this).text()); }); }); // this is much better. no need for eval() $(document).ready(function() { $('#fade').cycle(); }); // updated pageNavi with callback function pageNavi(itemid) { $("#content").load("pageNavi.php?page=" + itemid, function () { $('#fade').cycle(); }); $("#navi-secondary").load("catagory_navi.php"); }