肥强陆陆 2016-06-24 08:52 采纳率: 0%
浏览 1495

iealert.js在jquery1.11.3下如何启用?

iealert.js在jquery1.11.3下如何启用?我下的实例总用到的是jquery1.8.3可以正常显示,但由于站点jquery1.11.3导致无法正常启用,请问如何解决?谢谢!
图片说明

 (function($){
$("#goon").on("click", function(){
        $("#ie-alert-overlay").hide();  
        $("#ie-alert-panel").hide();                          
});
function initialize($obj, support, title, text){

        var panel = "<span>"+ title +"</span>"
                  + "<p> "+ text +"</p>"
                  + "<div class='browser'>"
                  + "<ul>"
                  + "<li><a class='chrome' href='https://www.google.com/chrome/' target='_blank'></a></li>"
                  + "<li><a class='firefox' href='http://www.mozilla.org/en-US/firefox/new/' target='_blank'></a></li>"
                  + "<li><a class='ie9' href='http://windows.microsoft.com/en-US/internet-explorer/downloads/ie/' target='_blank'></a></li>"
                  + "<li><a class='safari' href='http://www.apple.com/safari/download/' target='_blank'></a></li>"
                  + "<li><a class='opera' href='http://www.opera.com/download/' target='_blank'></a></li>"
                  + "<ul>"
                  + "</div>"; 

        var overlay = $("<div id='ie-alert-overlay'></div>");
        var iepanel = $("<div id='ie-alert-panel'>"+ panel +"</div>");

        var docHeight = $(document).height();

        overlay.css("height", docHeight + "px");





        if (support === "ie8") {            // shows the alert msg in IE8, IE7, IE6

            if ($.browser.msie  && parseInt($.browser.version, 10) < 9) {

                $obj.prepend(iepanel);
                $obj.prepend(overlay);

            }

            if ($.browser.msie  && parseInt($.browser.version, 10) === 6) {


                $("#ie-alert-panel").css("background-position","-626px -116px");
                $obj.css("margin","0");

            }


        } else if (support === "ie7") {     // shows the alert msg in IE7, IE6

            if ($.browser.msie  && parseInt($.browser.version, 10) < 8) {

                $obj.prepend(iepanel);
                $obj.prepend(overlay);
            }

            if ($.browser.msie  && parseInt($.browser.version, 10) === 6) {

                $("#ie-alert-panel").css("background-position","-626px -116px");
                $obj.css("margin","0");

            }

        } else if (support === "ie6") {     // shows the alert msg only in IE6

            if ($.browser.msie  && parseInt($.browser.version, 10) < 7) {

                $obj.prepend(iepanel);
                $obj.prepend(overlay);

                $("#ie-alert-panel").css("background-position","-626px -116px");
                $obj.css("margin","0");

            }
        }

}; //end initialize function


    $.fn.iealert = function(options){
        var defaults = { 
            support: "ie7",  // ie8 (ie6,ie7,ie8), ie7 (ie6,ie7), ie6 (ie6)
            title: "\u4F60\u77E5\u9053\u4F60\u7684Internet Explorer\u662F\u8FC7\u65F6\u4E86\u5417?", // title text
            text: "\u4E3A\u4E86\u5F97\u5230\u6211\u4EEC\u7F51\u7AD9\u6700\u597D\u7684\u4F53\u9A8C\u6548\u679C,\u6211\u4EEC\u5EFA\u8BAE\u60A8\u5347\u7EA7\u5230\u6700\u65B0\u7248\u672C\u7684Internet Explorer\u6216\u9009\u62E9\u53E6\u4E00\u4E2Aweb\u6D4F\u89C8\u5668.\u4E00\u4E2A\u5217\u8868\u6700\u6D41\u884C\u7684web\u6D4F\u89C8\u5668\u5728\u4E0B\u9762\u53EF\u4EE5\u627E\u5230.<br /><br /><h1 id='goon' style='font-size:20px;cursor:pointer;'>>>>\u7EE7\u7EED\u8BBF\u95EE</h1>"
        };


        var option = $.extend(defaults, options);




            return this.each(function(){
                if ( $.browser.msie ) {
                    var $this = $(this);  
                    initialize($this, option.support, option.title, option.text);
                } //if ie   
            });            

    };
})(jQuery);

  • 写回答

2条回答 默认 最新

  • Go 旅城通票 2016-06-24 08:57
    关注

    jQuery没有正确导入,jquery版本没关系。。注意2+不支持ie8-

    评论

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?