0

I'm using 2 jquery same plugins of different versions and the thing is one only works in body and the other in head.

I tried using no conflict following this tutorial: Using different versions of jQuery and jQueryUI together

But nothing, I guess it may be related with one plugin being called from the body and the other from head, anyway maybe you have a suggestion to solve this :D

/*This is the head plugin*/
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>

/*And this is the body plugin*/
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript" ></script>

<script type="text/javascript" src="jquery.easing.1.3.js"></script>
<script type="text/javascript">
    $(function() {
        var current = 1;
        var iterate = function(){
            var i = parseInt(current+1);
            var lis = $('#rotmenu').children('li').size();
            if(i>lis) i = 1;
            display($('#rotmenu li:nth-child('+i+')'));
        }
        display($('#rotmenu li:first'));
        var slidetime = setInterval(iterate,3000);

        $('#rotmenu li').bind('click',function(e){
            clearTimeout(slidetime);
            display($(this));
            e.preventDefault();
        });

        function display(elem){
            var $this = elem;
            var repeat = false;
            if(current == parseInt($this.index() + 1))
                repeat = true;

            if(!repeat)
                $this.parent().find('li:nth-child('+current+') a').stop(true,true).animate({'marginRight':'-20px'},300,function(){
                    $(this).animate({'opacity':'0.7'},700);
                });

            current = parseInt($this.index() + 1);
            var elem = $('a',$this);

            elem.stop(true,true).animate({'marginRight':'0px','opacity':'1.0'},300);

            var info_elem = elem.next();
            $('#rot1 .heading').animate({'left':'-420px'}, 500,'easeOutCirc',function(){
                $('h1',$(this)).html(info_elem.find('.info_heading').html());
                $(this).animate({'left':'0px'},400,'easeInOutQuad');
             });

             $('#rot1 .description').animate({'bottom':'-270px'},500,'easeOutCirc',function(){
                $('p',$(this)).html(info_elem.find('.info_description').html());
                $(this).animate({'bottom':'0px'},400,'easeInOutQuad');
            })
            $('#rot1').prepend(
                $('<img/>',{
                    style: 'opacity:0',
                    className: 'bg'
                }).load(
                    function(){
                        $(this).animate({'opacity':'1'},600);
                        $('#rot1 img:first').next().animate({'opacity':'0'},700,function(){
                            $(this).remove();
                        });
                    }
                 ).attr('src','images/'+info_elem.find('.info_image').html()).attr('width','800').attr('height','300')
            );
        }
   });
</script>
Community
  • 1
  • 1

1 Answers1

0

There is no need to import jQuery two times, in the head and in the body(?)...

Just import all your plugins and declare your scripts in the head:

<html>

<head>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    <script type="text/javascript" src="jquery.easing.1.3.js"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            console.log("Inside the 'head' tag you declare your plugins, scripts, css, etc...");
        });
    </script>
</head>
<body>
    <p>Inside the body you build your page with divs, img's, p's, span's, etc ...</p>
</body>

</html>

By the way, I noticed that you are using to different versions of jQuery, 1.3 and last (1.9.1), you should use only the latest version http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js

And don't forget, jQuery must be the first script to declare, then the plugins, then your own code...

António Almeida
  • 9,620
  • 8
  • 59
  • 66