Changeset 607313
- Timestamp:
- 10/03/2012 05:18:51 AM (13 years ago)
- Location:
- auto-thickbox-plus/trunk
- Files:
-
- 3 edited
-
readme.txt (modified) (1 diff)
-
thickbox.js (modified) (12 diffs)
-
thickbox.min.js (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
auto-thickbox-plus/trunk/readme.txt
r607300 r607313 282 282 * NEW: "View - Margin - Window" option 283 283 * CHANGED: Removed CSS hacks for IE6. Replaced CSS Expression with JavaScript. 284 * FIXED: Invalid positioning. some mobile browsers, such as older iOS (iPhone/iPad/iPod touch) and older Android, do not support `position:fixed` style. 284 285 * FIXED: Gallery images cannot be displayed in gallery style with [Cleaner Gallery](http://wordpress.org/extend/plugins/cleaner-gallery/) 285 286 -
auto-thickbox-plus/trunk/thickbox.js
r607300 r607313 57 57 imgLoader = new Image();// preload image 58 58 imgLoader.src = tb_pathToImage; 59 60 var result, ua = navigator.userAgent; 61 var webKitMatch = (result = ua.match(/AppleWebKit\/([0-9]+)/)) && result[1] < 534; 62 var operaMobiMatch = (result = ua.match(/Opera Mobi\/([0-9]+)/)) && result[1] < 7458; 63 var fennecMatch = (result = ua.match(/Fennec\/([0-9]+)/)) && result[1] < 6; 64 65 notSupportedPositionFixed = typeof document.body.style.maxHeight == 'undefined' // IE < 7 66 || (/(iPhone|iPod|iPad)/.test(navigator.platform) && webKitMatch) // iOS < 5 (iPhone/iPad/iPod touch) 67 || (ua.indexOf("Android") > -1 && webKitMatch) // Android < 3.0 68 || (window.operamini && Object.prototype.toString.call(window.operamini) === "[object OperaMini]") // Opera Mini 69 || operaMobiMatch // Opera Mobile < 11.0 70 || fennecMatch // Firefox for Mobile < 6.0 71 || (window.palmGetResource && webKitMatch) // HP webOS < 3.0 72 || (ua.indexOf("MeeGo") > -1 && ua.indexOf("NokiaBrowser/8.5.0") > -1); // MeeGo 59 73 }); 60 74 … … 110 124 function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link 111 125 try { 112 if ( typeof document.body.style.maxHeight === "undefined") {//if IE 6126 if (notSupportedPositionFixed) {//if IE 6 113 127 jQuery("body","html").css({height: "100%", width: "100%"}); 114 128 jQuery("html").css("overflow","hidden"); 115 if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6 116 jQuery("body").append("<iframe id='TB_HideSelect'>"+thickboxL10n.noiframes+"</iframe><div id='TB_overlay'></div><div id='TB_window'></div>"); 129 if (typeof document.body.style.maxHeight == "undefined" && document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6 130 jQuery("body").append("<iframe id='TB_HideSelect'>"+thickboxL10n.noiframes+"</iframe>"); 131 } 132 } 133 if(document.getElementById("TB_overlay") === null){ 134 jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>"); 135 if (notSupportedPositionFixed) { 117 136 jQuery("#TB_overlay, #TB_HideSelect").css({ 118 137 position: 'absolute', 119 138 height: (document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight) + 'px' 120 139 }); 121 if (tb_options.click_bg == "close") 122 jQuery("#TB_overlay").click(tb_remove); 123 } 124 }else{//all others 125 if(document.getElementById("TB_overlay") === null){ 126 jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>"); 127 if (tb_options.click_bg == "close") 128 jQuery("#TB_overlay").click(tb_remove); 129 } 140 } 141 if (tb_options.click_bg == "close") 142 jQuery("#TB_overlay").click(tb_remove); 130 143 } 131 144 … … 137 150 138 151 jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page 139 if ( typeof document.body.style.maxHeight == "undefined") {152 if (notSupportedPositionFixed) { 140 153 jQuery("#TB_load").css({ 141 154 position: 'absolute', … … 622 635 case "zoom": 623 636 jQuery("#TB_window").height(jQuery("#TB_window").height()); // for image 624 if ( typeof document.body.style.maxHeight == "undefined"&& jQuery("body").css("position") != "relative")637 if (notSupportedPositionFixed && jQuery("body").css("position") != "relative") 625 638 jQuery("#TB_window").css({marginTop: -jQuery("#TB_window").height() / 2, top: jQuery(window).height() / 2 + jQuery(document).scrollTop()}); 626 639 jQuery("#TB_Image").hide().show(tb_options.effect_speed); … … 628 641 break; 629 642 case "slide": 630 if ( typeof document.body.style.maxHeight == "undefined"&& jQuery("body").css("position") != "relative")643 if (notSupportedPositionFixed && jQuery("body").css("position") != "relative") 631 644 jQuery("#TB_window").css({marginTop: -jQuery("#TB_window").height() / 2, top: jQuery(window).height() / 2 + jQuery(document).scrollTop()}); 632 645 jQuery("#TB_window").slideDown(tb_options.effect_speed, callback); … … 645 658 jQuery("#TB_title").height(Math.max(jQuery("#TB_title").height(), jQuery("#TB_ajaxWindowTitle").height() + 13)); // TODO: workaround code for the height of multiline title (to be modified) 646 659 647 if ( typeof document.body.style.maxHeight == "undefined") {660 if (notSupportedPositionFixed) { 648 661 jQuery("#TB_window").css({ 649 662 position: 'absolute', … … 712 725 var callback = function() { 713 726 jQuery('#TB_window,#TB_overlay,#TB_HideSelect').trigger("tb_unload").unbind().remove(); 714 if ( typeof document.body.style.maxHeight == "undefined") {//if IE 6727 if (notSupportedPositionFixed) {//if IE 6 715 728 jQuery("body","html").css({height: "auto", width: "auto"}); 716 729 jQuery("html").css("overflow",""); … … 742 755 var marginLeft = -parseInt((width / 2),10); 743 756 var marginTop = -parseInt((height / 2),10); 744 var isIE6 = typeof document.body.style.maxHeight === "undefined";757 var isIE6 = notSupportedPositionFixed; 745 758 if (!isIE6 && jQuery("#TB_window").css("position") == "absolute") { 746 759 marginLeft += jQuery(document).scrollLeft(); … … 890 903 function tb_resize_init() { 891 904 jQuery("#TB_window").append("<div id='TB_Resize'><div id='TB_ResizeN'></div><div id='TB_ResizeE'></div><div id='TB_ResizeW'></div><div id='TB_ResizeS'></div><div id='TB_ResizeNE'></div><div id='TB_ResizeNW'></div><div id='TB_ResizeSE'></div><div id='TB_ResizeSW'></div></div>"); 892 if ( typeof document.body.style.maxHeight == "undefined") // height:100% on position:absolute does not work in IE6905 if (notSupportedPositionFixed) // height:100% on position:absolute does not work in IE6 893 906 jQuery("#TB_ResizeE, #TB_ResizeW").height(jQuery("#TB_window").height()); 894 907 } … … 903 916 var offsetLeft = jQuery("#TB_window").offset().left - parseInt(jQuery("#TB_window").css("marginLeft")); // cancel negative margin 904 917 var offsetTop = jQuery("#TB_window").offset().top - parseInt(jQuery("#TB_window").css("marginTop")); 905 if ( typeof document.body.style.maxHeight != "undefined"&& jQuery("#TB_window").css("position") != "absolute") { // IE6 has no scroll bar (width/height: 100%)918 if (!notSupportedPositionFixed && jQuery("#TB_window").css("position") != "absolute") { // IE6 has no scroll bar (width/height: 100%) 906 919 offsetLeft -= jQuery(document).scrollLeft(); 907 920 offsetTop -= jQuery(document).scrollTop(); … … 927 940 var signX = (action == "e-resize" || action == "ne-resize" || action == "se-resize") ? +1 : -1; // east (northeast, southeast) or not 928 941 var signY = (action == "s-resize" || action == "se-resize" || action == "sw-resize") ? +1 : -1; // south (southeast, southwest) or not 929 if ( typeof document.body.style.maxHeight == "undefined")942 if (notSupportedPositionFixed) 930 943 var startMarginTop = jQuery("#TB_window").css("marginTop"); 931 944 } … … 976 989 if (source == "image") 977 990 jQuery("#TB_ImageClick > a").height(jQuery("#TB_Image").outerHeight(true)); 978 if ( typeof document.body.style.maxHeight == "undefined") // undo rewritten marginTop in IE6991 if (notSupportedPositionFixed) // undo rewritten marginTop in IE6 979 992 jQuery("#TB_window").css("marginTop", startMarginTop); 980 993 }
Note: See TracChangeset
for help on using the changeset viewer.