Skip to content
This repository has been archived by the owner on Feb 7, 2018. It is now read-only.

Commit

Permalink
Got it working in IE6 by just using gifs. Screw you IE6.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnunemaker committed Aug 7, 2008
1 parent 6dadca0 commit 592cfb8
Show file tree
Hide file tree
Showing 18 changed files with 29 additions and 11 deletions.
Binary file added fireworks/closebox.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified fireworks/shadow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/bl.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/bm.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/bm.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/br.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/closebox.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/ml.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/ml.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/mr.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/mr.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/tl.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/tm.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/tm.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/tr.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/x.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion index.html
Expand Up @@ -19,7 +19,7 @@
</script> </script>


<style type="text/css" media="screen"> <style type="text/css" media="screen">
body {font-family:Helvetica, Arial, sans-serif;} body {font-family:Helvetica, Arial, sans-serif; background:#ccc;}
p {margin:0; padding:0;} p {margin:0; padding:0;}
#small_box {width:150px; height:100px;} #small_box {width:150px; height:100px;}
#medium_box {width:300px; height:200px;} #medium_box {width:300px; height:200px;}
Expand Down
38 changes: 28 additions & 10 deletions js/fancyzoom.js
Expand Up @@ -46,6 +46,13 @@ var FancyZoomBox = {
if (FancyZoomBox.setup) return; if (FancyZoomBox.setup) return;
FancyZoomBox.setup = true; FancyZoomBox.setup = true;


var ie = navigator.userAgent.match(/MSIE\s(\d)+/);
if (ie) {
var version = parseInt(ie[1]);
Prototype.Browser['IE' + version.toString()] = true;
Prototype.Browser.ltIE7 = (version < 7) ? true : false;
}

var html = '<div id="zoom" style="display:none;"> \ var html = '<div id="zoom" style="display:none;"> \
<table id="zoom_table" style="border-collapse:collapse; width:100%; height:100%;"> \ <table id="zoom_table" style="border-collapse:collapse; width:100%; height:100%;"> \
<tbody> \ <tbody> \
Expand Down Expand Up @@ -84,6 +91,11 @@ var FancyZoomBox = {
FancyZoomBox.zoom_close.observe('click', FancyZoomBox.hide); FancyZoomBox.zoom_close.observe('click', FancyZoomBox.hide);
FancyZoomBox.middle_row = $A([$$('td.ml'), $$('td.mm'), $$('td.mr')]).flatten(); FancyZoomBox.middle_row = $A([$$('td.ml'), $$('td.mm'), $$('td.mr')]).flatten();
FancyZoomBox.cells = FancyZoomBox.zoom_table.select('td'); FancyZoomBox.cells = FancyZoomBox.zoom_table.select('td');

// just use gifs as ie6 and below suck
if (Prototype.Browser.ltIE7) {
FancyZoomBox.switchBackgroundImagesTo('gif');
}
}, },


show: function(e) { show: function(e) {
Expand Down Expand Up @@ -165,21 +177,27 @@ var FancyZoomBox = {
], { duration: 0.5 }); ], { duration: 0.5 });
}, },


// switches the backgrounds of the cells and the close image to png's or gif's
// fixes ie's issues with fading and appearing transparent png's with
// no background and ie6's craptacular handling of transparent png's
switchBackgroundImagesTo: function(to) {
FancyZoomBox.cells.each(function(td) {
var bg = td.getStyle('background-image').gsub(/\.(png|gif|none)\)$/, '.' + to + ')');
td.setStyle('background-image: ' + bg);
});
var close_img = FancyZoomBox.zoom_close.firstDescendant();
var new_img = close_img.readAttribute('src').gsub(/\.(png|gif|none)$/, '.' + to);
close_img.writeAttribute('src', new_img);
},

// prevents the thick black border that happens when appearing or fading png in IE // prevents the thick black border that happens when appearing or fading png in IE
fixBackgroundsForIE: function() { fixBackgroundsForIE: function() {
if (Prototype.Browser.IE) { if (Prototype.Browser.IE7) { FancyZoomBox.switchBackgroundImagesTo('gif'); }
FancyZoomBox.cells.each(function(td) {
td.setStyle('background-color:#fff');
});
}
}, },


// swaps back to png's for prettier shadows
unfixBackgroundsForIE: function() { unfixBackgroundsForIE: function() {
if (Prototype.Browser.IE) { if (Prototype.Browser.IE7) { FancyZoomBox.switchBackgroundImagesTo('png'); }
FancyZoomBox.cells.each(function(td) {
td.setStyle('background-color:none');
});
}
} }
} }


Expand Down

0 comments on commit 592cfb8

Please sign in to comment.