jquery与哇滑块冲突

时间:2015-09-06 17:17:06

标签: javascript jquery html

所以我有这个使用jquery-1.6.4.min.js

的HTML页面

<script type="text/javascript">
if (window.jQuery == undefined) document.write( unescape('%3Cscript src="js/jquery-1.6.4.min.js" type="text/javascript"%3E%3C/script%3E') ); </script>
        <script src="js/jquery.prettyPhoto.js" type="text/javascript"></script>
        <script src="js/script.js" type="text/javascript"></script>
        <script type="text/javascript">
            jQuery(document).ready(function(){
                if (jQuery.browser.msie && jQuery.browser.version < 9){
                    var $windowWidth = jQuery(window).width()+17;
                    var $windowHeight = jQuery(window).height()+17;
                } else {
                    var $windowWidth = window.innerWidth;
                    var $windowHeight = window.innerHeight;
                }

                var $image = jQuery('.bgImage img');
                var img = new Image();

                img.src = jQuery($image).attr('src');

                var intervalId = setInterval(function(){
                    if (img.complete){
                        var $imgWidth = img.width;
                        var $imgHeight = img.height;
                        var $widthFactor = parseFloat($imgWidth/$windowWidth);
                        var $heightFactor = parseFloat($imgHeight/$windowHeight);

                        if ($widthFactor < $heightFactor){
                            jQuery($image).css({width:$windowWidth+'px', height:parseInt($imgHeight/$widthFactor)+'px', top:'-'+parseInt((parseInt($imgHeight/$widthFactor)-$windowHeight)/2)+'px', left:0});
                        } else {
                            jQuery($image).css({width:parseInt($imgWidth/$heightFactor)+'px', height:$windowHeight+'px', top:0, left:'-'+parseInt((parseInt($imgWidth/$heightFactor)-$windowWidth)/2)+'px'});
                        }

                        clearInterval(intervalId);
                        LoadImageStart();
                    }
                }, 50);

                function LoadImageStart(){
                    $image.parent().fadeIn(500, function(){
                        jQuery(this).css({display:'block'});
                    });
                }

                jQuery(window).resize(function(){
                    if (jQuery.browser.msie && jQuery.browser.version < 9){
                        var $windowWidth = jQuery(window).width()+17;
                        var $windowHeight = jQuery(window).height();
                    } else {
                        var $windowWidth = window.innerWidth;
                        var $windowHeight = window.innerHeight;
                    }

                    var $imgWidth = img.width;
                    var $imgHeight = img.height;
                    var $widthFactor = parseFloat($imgWidth/$windowWidth);
                    var $heightFactor = parseFloat($imgHeight/$windowHeight);

                    if ($widthFactor < $heightFactor){
                        jQuery($image).css({width:$windowWidth+'px', height:parseInt($imgHeight/$widthFactor)+'px', top:'-'+parseInt((parseInt($imgHeight/$widthFactor)-$windowHeight)/2)+'px', left:0});
                    } else {
                        jQuery($image).css({width:parseInt($imgWidth/$heightFactor)+'px', height:$windowHeight+'px', top:0, left:'-'+parseInt((parseInt($imgWidth/$heightFactor)-$windowWidth)/2)+'px'});
                    }
                });
            });
        </script>



    </body>

我想添加一个需要添加此javascript的wowslider幻灯片。

<script type="text/javascript" src="engine1/jquery.js"></script>

问题在于,当我添加它时,页面变得混乱,许多功能都停止工作。

我从未遇到类似的问题。 我用谷歌搜索它,我称之为jquery冲突。 我该如何解决? 谢谢:))

0 个答案:

没有答案