Question

I'm using prettyPhoto to show my photos, but when i use it breaks other 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>

When I use prettyPhoto, UItoTop stops working. UItoTop works fine as long as you do not click on any image to start prettyPhoto.

The code of readyVisorFotos() is

   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();
 }

Can anyone help me?

Was it helpful?

Solution

I use callback.

 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' });
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top