zoukankan      html  css  js  c++  java
  • thickbox IE7 下错位补丁

    As previously mentioned in this post Thickbox 3.1 is currently broken in many revisions of Internet Explorer 7. Specifically, those revisions who return the substring “MSIE 6.0″ in the user-agent string.

    Update:July2008

    This patch fixes a problem caused when certain installations of IE7 are incorrectly identified as IE6 causing the thickbox window to be positioned partially hidden in the top left hand corner of the viewport . It has become apparent that there are other bugs triggered in other revisions of IE7 which cause another type of miss-positioning with the thickbox window being centered correctly but outside of the viewport. This patch doesn’t fix that

    As this is such a widespread problem, and lots of people seem to be having a little difficulty patching their copies of thickbox.js I thought i’d provide a patched copy here. But first a bit of background for those who are interested in why it’s broken. The following if statement in the function tb_position is as follows:

    thickbox.jsline284

    if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6 $("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'}); }

    The bug is triggered when, in certain revisions of IE7 jQuery.browser.version == 6, resulting in the Thickbox window not receiving the correct CSS positioning. (In IE6, the window receives it position through some clever CSS expressions in thickbox.css)

    The workaround for all this though is fairly straightforward. You simply need a more accurate way for weeding out IE6… and here it is.

    $.browser.msie6

    $.browser.msie6 = $.browser.msie && /MSIE 6\.0/i.test(window.navigator.userAgent) && !/MSIE 7\.0/i.test(window.navigator.userAgent);

    Once we have this new property defined within the $.browser object we can use it to fix the conditional statement mentioned previously. You can define $.browser.msie6 in thickbox.js (like i have in the patched copies of thickbox below), or patch jQuery itself. Or whatever. It’s up to you. After that all that needs to be done is to modify the following line to make use of our new IE6 sniffer:

    thickbox.jsline284

    if ( !(jQuery.browser.msie6)) { // take away IE6 $("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'}); }

    If you don’t feel confident patching your own copy of thickbox then feel free to grab a patched copy below. This is thickbox 3.1 with the abovementioned code modifications applied and should simply replace your existing file.

    Let me know if you find this useful


    大家只需把patch的js文件改成thickbox.js覆盖以前的js文件即可

  • 相关阅读:
    关于i 标签盛放背景图像
    关于首行缩进
    复选框样式自定义
    创建对象的两种方法
    SpringBoot项目中常见的注解
    微服务 第一章:Idea快速创建SpringBoot项目
    Exception in thread "Thread-1" java.util.ConcurrentModificationException 异常原因和解决方法
    《改善java代码》第四章:改善关于字符串的代码
    IDEA忽略不必要提交的文件
    Git分支管理
  • 原文地址:https://www.cnblogs.com/goody9807/p/1428827.html
Copyright © 2011-2022 走看看