簡體   English   中英

IE中的jQuery插件問題

[英]jQuery plugin issues in IE

我不明白為什么我的代碼無法在Internet Explorer上運行/這是我在調用js庫的index.php中。

<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="js/shadowbox.js" ></script>
    <script type="text/javascript" src="js/slides.min.jquery.js" > </script>
    <script type="text/javascript" src="js/jquery.simpleWeather-2.0.1.min.js" > </script>
    <script type="text/javascript" src="js/jquery.clock.js" > </script>
    <script type="text/javascript" src="js/jquery-ui-1.8.17.custom.min.js"></script>
    <script type="text/javascript" src="js/default.js" > </script>

這是我的default.js

$(document).ready(function() {
    Shadowbox.init({
        overlayOpacity: 0.8
    }, setupDemos);

    if (typeof $().slides != "undefined") {
        $('#slides').slides({
            preload: true,
            preloadImage: 'images/slides/loading.gif',
            play: 3000,
            pause: 2500,
            hoverPause: true,
            animationStart: function(current){
                $('.caption').animate({
                    bottom:-35
                },100);
            },
            animationComplete: function(current){
                $('.caption').animate({
                    bottom:0
                },200);
            },
            slidesLoaded: function() {
                $('.caption').animate({
                    bottom:0
                },200);
            }
        });
    }

    $.each($(".menu li"), function(index, li) {
        if ($(li).hasClass("active")) {
            $("title").append(": " + $(li).children("a").text());
        }
    });

    if (typeof $.simpleWeather != "undefined") {
        $.simpleWeather({
            location: 'Armenia, Yerevan',
            unit: 'c',
            success: function(weather) {
                html = "<div style='height: 117px;'><h2>"+weather.city+', '+weather.region+'</h2>';
                html += '<img style="float:left;" width="125px" src="'+weather.image+'">';
                html += '<p>'+weather.temp+'&deg; '+weather.units.temp+'<br /></p>';
                html += '</div>';

                $("#weather").html(html);
            },
            error: function(error) {
                $("#weather").html('<p>'+error+'</p>');
            }
        });
    }

    $('#yerevan-time').clock({offset: '+4', type: 'analog'});
    $('#london-time').clock({offset: '+0', type: 'analog'});
    $('#new-york-time').clock({offset: '-5', type: 'analog'});
});

function setupDemos() {
    Shadowbox.setup("a[rel=photos]", {
        gallery:        "cars",
        continuous:     true,
        counterType:    "skip"
    });
}


$(function() {
    $( "#day1" ).datepicker();
    $( "#day2").datepicker();
    });

我在這里找不到解決方案。 您可以在這里查看 這是我的網站。 因此,在Internet Explorer中,時鍾和天氣不起作用。 這是什么問題 任何幫助將是有用的。 謝謝。

該錯誤與您發布的代碼無關。

如果您檢查控制台,則會看到與Google地圖有關的錯誤。

並且在運行initialize方法時會引發該錯誤( 您已將其綁定到body標簽的onload事件

刪除該時鍾以檢查時鍾是否正常工作,然后確保僅在頁面上顯示地圖時才運行。


更新資料

您遇到的另一個更重要的問題是您使用的時鍾插件具有如下代碼

jQuery(_this)
    .find(".sec")
    .css({"-moz-transform" : srotate, "-webkit-transform" : srotate});

看到供應商前綴-moz--webkit-意味着手的旋轉僅應用於mozilla和webkit瀏覽器。

他們明確排除了所有其他瀏覽器。


現代IE(> = 9)解決方法

對於IE> = 9,您可以添加"-ms-transform" : srotate

jQuery(_this)
        .find(".sec")
        .css({"-moz-transform" : srotate, "-webkit-transform" : srotate, "-ms-transform" : srotate});

並且它可以正常工作( 因為IE> = 9支持旋轉。

確保更正所有雙手的代碼。我的示例只有幾秒鍾

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM