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文件即可

  • 相关阅读:
    eclipse中开发android程序时,打开layout配置文件自动关闭的问题
    成功用WAP登陆ZBlog发表文章
    java环境变量配置
    Eclipse快捷键大全
    Android SDK 2.2 开发环境搭建
    用EnterpriseLibrary来自动管理与数据库的连接
    一个普通网站发展成大型网站过程中的架构演变史
    有关Silverlight TabControl组件的研究
    有关Silverlight浮动窗体组件的研究
    强大的DataGrid组件[9]_自定义头模板
  • 原文地址:https://www.cnblogs.com/goody9807/p/1428827.html
Copyright © 2011-2022 走看看