2
我想從ajax加載flexslider。當我直接指向包含滑塊的頁面時,它起作用,但是從ajax滑塊不加載。從ajax加載flexslider
這是我的AJAX頁面:
$(document).ready(function(){
//Ajax Event Handler For Categorie Demo
var $menu1 = $('#navDemo02');
function success(){
$('div.ajaxContent').hide();
$('div.ajaxContent').show(200);
}
function ajaxCallTimeout(index){
var url = 'categorie/0'+(index+1)+'.php';
$('div.ajaxContent').load(url, success);
}
function ajaxCategorie(){
var index = $menu1.find('li a').index(this);
$('div.ajaxContent').html('<p style="color:#4CC3EC; text-align:center; margin-top:45px;">Loading...<img src="img/loading.gif" /></p>');
switch(index){
case 0 :
$('div.ajaxContent').stop().animate({marginTop: 0}, 1000,'linear', function(){ajaxCallTimeout(index)});
break;
case 1 :
$('div.ajaxContent').stop().animate({marginTop: 0}, 1000,'linear', function(){ajaxCallTimeout(index)});
break;
case 2 :
$('div.ajaxContent').stop().animate({marginTop: 0}, 1000,'linear',function(){ajaxCallTimeout(index)});
break;
case 3 :
$('div.ajaxContent').stop().animate({marginTop: 0}, 1000,'linear', function(){ajaxCallTimeout(index)});
break;
case 4 :
$('div.ajaxContent').stop().animate({marginTop:0}, 1000,'linear', function(){ajaxCallTimeout(index)});
break;
case 5 :
$('div.ajaxContent').stop().animate({marginTop: 0}, 1000,'linear', function(){ajaxCallTimeout(index)});
break;
case 6 :
$('div.ajaxContent').stop().animate({marginTop: 0}, 1000,'linear', function(){ajaxCallTimeout(index)});
break;
}
}
$menu1.find('li a').bind('click', ajaxCategorie);
});
下面是滑塊
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.min.js">\x3C/script>')</script>
<script defer src="jquery.flexslider.js"></script>
<script type="text/javascript">
$(function(){
SyntaxHighlighter.all();
});
$(window).load(function(){
$('.flexslider').flexslider({
animation: "slide"
});
});
誰能告訴我什麼,我丟失或指向我了教程中的腳本?
你能否詳細說明如何重新運行它?我想我有一個類似的問題顯示在這裏:http://stackoverflow.com/questions/25194457/js-error-after-ajax-get-load – calav3ra