我正在使用prettyPhoto来显示我的照片,但是当我使用它时会打破其他js。
<script src="/js/UItoTop/js/easing.js" type="text/javascript"></script>
<script src="/js/UItoTop/js/jquery.ui.totop.js" type="text/javascript"></script>
<link rel="stylesheet" media="screen,projection" href="/js/UItoTop/css/ui.totop.css" />
<!-- Media LightBox -->
<link rel="stylesheet" href="css/prettyPhoto.css" type="text/css" media="screen" title="prettyPhoto main stylesheet" charset="utf-8" />
<script src="js/jquery.prettyPhoto.js" type="text/javascript" charset="utf-8"></script>
{literal}
<script type="text/javascript">
onload = function(){
readyVisorFotos();
}
</script>
<script type="text/javascript">
$(document).ready(function() {
var defaults = {
containerID: 'toTop', // fading element id
containerHoverID: 'toTopHover', // fading element hover id
scrollSpeed: 1200,
easingType: 'linear'
};
$().UItoTop({ easingType: 'easeOutQuart' });
});
</script>
当我使用prettyPhoto时,UItoTop停止工作。只要您不点击任何图像来启动prettyPhoto,UItoTop就可以正常工作。
readyVisorFotos()的代码是
function readyVisorFotos(){
$("a[rel^='prettyPhoto']").prettyPhoto({show_title:false,autoplay_slideshow: true,slideshow: 5000});
$(".clipping a[rel^='prettyPhoto']").prettyPhoto({show_title:true,autoplay_slideshow: true,slideshow: 5000});
$(".noticiabrief a[rel^='prettyPhoto']").prettyPhoto();
}
任何人都可以帮助我吗?
答案 0 :(得分:0)
我使用回调。
function readyVisorFotos(){
$("a[rel^='prettyPhoto']").prettyPhoto({show_title:false,autoplay_slideshow: true,slideshow: 5000,callback: function(){UItoTop();}});
$(".clipping a[rel^='prettyPhoto']").prettyPhoto({show_title:true,autoplay_slideshow: true,slideshow: 5000,callback: function(){UItoTop();}});
$(".noticiabrief a[rel^='prettyPhoto']").prettyPhoto({show_title:false,callback: function(){UItoTop();}});
}
function UItoTop(){
var defaults = {
containerID: 'toTop', // fading element id
containerHoverID: 'toTopHover', // fading element hover id
scrollSpeed: 1200,
easingType: 'linear'
};
$().UItoTop({ easingType: 'easeOutQuart' });
}