Forum Moderators: not2easy

Message Too Old, No Replies

jQuery Galleria and IE6

         

krko

11:16 am on Sep 27, 2010 (gmt 0)

10+ Year Member



Hello,

For a project I'm doing I'm using the jQuery Galleria slideshow. All is well except standard themes that come with Galleria don't support IE6. It would be really hard to explain the exact problem I'm having only by posting code since I can't really say where the problem is coming from, but I'll try. I was wondering if anyone has had any success making IE6 and galleria play along nicely.

For those of you familiar with Galleria, I'm using the classic theme. In the beginning IE6 simply displayed the images one below the other. After reading a bit I found out that the way css was handled to IE6 from the javascript was problematic for IE6 so after a few changes to the galleria js file and moving the css reference to the html file on which the gallery appears I managed to get the IE6 display the page correctly with the correct layout. However all is not well yet...

The changes I did to make IE6 display the layout correctly:

1. Comment out the reference to the css file from the classic js theme like this: //css: 'galleria.[THEMENAME].css',

2. Link directly to the css file like this:
< link rel="stylesheet" type="text/css" href="[PATH_TO_GALLERIA]/themes/[THEMENAME]/galleria.[THEMENAME].css" />

3. In the galleria.js file (I'm using version 1.1.95) at about line 1952 find this code:

if (obj.css) {
var css;
proto.loop(proto.getElements('script'), function(el) {
var reg = new RegExp('galleria.' + obj.name.toLowerCase() + '.js');
if(reg.test(el.src)) {
css = el.src.replace(/[^\/]*$/, "") + obj.css;
proto.loadCSS(css, function() {
G.theme = theme;
jQuery(document).trigger( G.THEMELOAD );
});
}
});
if (!css) {
G.raise('No theme CSS loaded');
}
}
return theme;


and change it to this code:


if (obj.css) {
var css;
proto.loop(proto.getElements('script'), function(el) {
var reg = new RegExp('galleria.' + obj.name.toLowerCase() + '.js');
if(reg.test(el.src)) {
css = el.src.replace(/[^\/]*$/, "") + obj.css;
proto.loadCSS(css, function() {
G.theme = theme;
jQuery(document).trigger( G.THEMELOAD );
});
}
});
if (!css) {
G.raise('No theme CSS loaded');
}
} else { //########### EDIT HERE ###########
G.theme = theme;
jQuery(document).trigger( G.THEMELOAD );
}
return theme;

Now the gallery loads, page displays with correct layout, external buttons (play, pause, next, etc) work, the only problem is that images within the gallery are invisible.

How do I know that the gallery loads and works and only images are invisible? I've also added the option to galleria to display descriptions and titles from images (built in option in the script I just enabled it). If image has a title or description an "i" (png file) appears in the upper left corner of the image which you can click to see description. I can click this png file and I see the description. I've added a title and description only to one image out of 5, and if I press play, after a 5 sec (default slide play time) that "i" disappears and after 25 sec when galleria loops back it reappears.

What I'm trying to say is maybe all that's left to fix is a simple css hack for ie6 to make it display the images however, so far I've been unable to fix that.

I'd greatly appreciate if anyone could take a look at the galleria classic theme css file and see if there's something to change to make it work with IE6.

Thank you in advance,
Goran

krko

1:06 pm on Sep 27, 2010 (gmt 0)

10+ Year Member



Here is the galleria css file. It's rather short so I'm posting all of it.

.galleria-container{position:relative;overflow:hidden;background:#000;}
.galleria-container img{-moz-user-select:none;-webkit-user-select:none;-o-user-select:none;}
.galleria-stage{position:absolute;top:0px;bottom:0px;left:0px;right:0px;overflow:hidden;}
.galleria-thumbnails-container{height:50px;bottom:0;position:absolute;left:10px;right:10px;z-index:2;}
.galleria-carousel .galleria-thumbnails-list{margin-left:30px;margin-right:30px;}
.galleria-thumbnails .galleria-image{height:40px;width:60px;background:#000;margin:0 5px 0 0;border:1px solid #000;;float:left;cursor:pointer;}
.galleria-counter{position:absolute;bottom:10px;left:10px;text-align:right;color:#fff;font:normal 11px/1 arial,sans-serif;z-index:2;}
.galleria-loader{background:#000;width:20px;height:20px;position:absolute;top:10px;right:10px;z-index:2;display:none;background:url(classic-loader.gif) no-repeat 2px 2px;}
.galleria-info{width:50%;top:0px;left:0px;z-index:2;position:absolute;}
.galleria-info-text{background-color:#000;background-color:rgba(0,0,0,.9);padding: 12px;display:none;}
.galleria-info-title{font:bold 12px/1.1 arial,sans-serif;margin:0;color:#fff;}
.galleria-info-description{font:italic 12px/1.4 georgia,serif;margin:0;color:#bbb;}
.galleria-info-title+.galleria-info-description{margin-top:7px;}
.galleria-info-close{width:9px;height:9px;position:absolute;top:5px;right:5px;background-position:-753px -11px;opacity:.5;cursor:pointer;display:none;}
.galleria-info-link{background-position:-669px -5px;opacity:.8;position:absolute;width:20px;height:20px;cursor:pointer;background-color:#000;}
.galleria-info-link:hover,
.galleria-info-close:hover{opacity:.5;}
.galleria-image-nav{position:absolute;top:50%;margin-top:-15px;width:100%;height:31px;left:0;}
.galleria-image-nav-left,
.galleria-image-nav-right{opacity:.7;cursor:pointer;width:16px;height:31px;position:absolute;left:10px;z-index:2;}
.galleria-image-nav-right{left:auto;right:10px;background-position:-300px 0;z-index:2;}
.galleria-image-nav-left:hover,
.galleria-image-nav-right:hover{opacity:.5;}
.galleria-thumb-nav-left,
.galleria-thumb-nav-right{cursor:pointer;display:none;background-position:-495px 5px;position:absolute;left:0;top:0;height:40px;width:23px;z-index:3;opacity:.8;}
.galleria-thumb-nav-right{background-position:-578px 5px;border-right:none;right:0;left:auto;}
.galleria-thumbnails-container .disabled,
.galleria-thumbnails-container .disabled:hover{opacity:.2;cursor:default;}
.galleria-thumb-nav-left:hover,
.galleria-thumb-nav-right:hover{opacity:1;background-color:#111;}
.galleria-carousel .galleria-thumb-nav-left,
.galleria-carousel .galleria-thumb-nav-right{display:block;}
.galleria-thumb-nav-left,
.galleria-thumb-nav-right,
.galleria-info-link,
.galleria-info-close,
.galleria-image-nav-left,
.galleria-image-nav-right{background-image:url(classic-map.png);background-repeat:no-repeat;}

krko

11:04 am on Sep 28, 2010 (gmt 0)

10+ Year Member



can anyone spot something that might not work properly with ie6 in the above css?

thnx

milosevic

11:09 am on Sep 28, 2010 (gmt 0)

10+ Year Member



Are the images being output in the generated sourcecode?

To test this, with the page loaded in IEtester, click on "View Source" and then "view generated source" (which includes anything that has been output by JavaScript).

krko

3:53 pm on Sep 28, 2010 (gmt 0)

10+ Year Member



you add the images manually in the html file that embeds the gallery. here's the html. the div with the class images holds the images. anyway I'm checking with ietester and will tell you, it's in download now.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>untitled document</title>
<link rel="stylesheet" type="text/css" href="css/default.css" />
<link rel="stylesheet" type="text/css" href="galleria/themes/classic/galleria.classic.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="galleria/src/galleria.js"></script>
</head>
<body>

<script>
//Load Theme
Galleria.loadTheme('galleria/themes/classic/galleria.classic.js');
</script>

<div id="container">

<div id="menu" style="display:block;">a menu or logo goes here</div>

<div class="images">
<div>
<a href="#"><img src="galleries/editorial/1.jpg" title="test man..."></a>
<strong>Some Magazine</strong>
<span>Styling: Some Guy | Hair: Some Other Guy | Make-up: Some Woman</span>
</div>
<img src="galleries/editorial/2.jpg">
<img src="galleries/editorial/3.jpg">
<img src="galleries/editorial/4.jpg">
</div>

<div id="controls" style="display:block;">
<a id="g_next" href="#">NEXT</a><br />
<a id="g_prev" href="#">PREV</a><br />
<a id="g_play" href="#">PLAY</a><br />
<a id="g_pause" href="#">PAUSE</a>
</div>

<div id="leftfooter">
EDITORIAL<br />
COMMERCIAL<br />
CONTACT<br />
BIO<br />
EXHIBITIONS
</div>

<div id="rightfooter">
maybe copyright or something goes here...</div>

</div>

<script>
$('.images').galleria({
thumbnails:false,
height:500,
preload:2,
image_position:'right',
image_margin:0,
show_imagenav:false,
data_config: function(img) {
// will extract and return image captions from the source:
return {
title: $(img).parent().next('strong').html(),
description: $(img).parent().next('strong').next().html()
};
},
extend: function() {
var gallery = this; // save the scope
$('#nav a').click(function(e) {
e.preventDefault(); // prevent default actions on the links
})
// attach gallery methods to links:
$('#g_prev').click(function() {
gallery.prev();
});
$('#g_next').click(function() {
gallery.next();
});
$('#g_play').click(function() {
gallery.play();
});
$('#g_pause').click(function() {
gallery.pause();
});
}

});
</script>

</body>
</html>

krko

4:09 pm on Sep 28, 2010 (gmt 0)

10+ Year Member



ok here's the ie interpreted html from ietester.
btw the script works fine in ie7 and the sources appear to be identical from a quick glance at both of them...

looking around different forums i found out that the galleria.js core is compatibble with the ie6, apparently it's the classic theme that's not. so if the problem lies in the js, that should be the first file to check.

...
<SCRIPT src="galleria/themes/classic/galleria.classic.js" async="true" onload="null"></SCRIPT>

<SCRIPT src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></SCRIPT>

<SCRIPT src="galleria/src/galleria.js"></SCRIPT>
</HEAD>
<BODY>
<SCRIPT>
//Load Theme
Galleria.loadTheme('galleria/themes/classic/galleria.classic.js');
</SCRIPT>

<DIV id=container>
<DIV id=menu style="DISPLAY: block">a menu or logo goes here</DIV>
<DIV class=images>
<DIV style="DISPLAY: none" jQuery1285689732952="1"><A href="#"><IMG title="test man..." src="galleries/editorial/1.jpg"></A> <STRONG>Some Magazine</STRONG> <SPAN>Styling: Some Guy | Hair: Some Other Guy | Make-up: Some Woman</SPAN></DIV><IMG style="DISPLAY: none" src="galleries/editorial/2.jpg" jQuery1285689732952="2"> <IMG style="DISPLAY: none" src="galleries/editorial/3.jpg" jQuery1285689732952="3"> <IMG style="DISPLAY: none" src="galleries/editorial/4.jpg" jQuery1285689732952="4">
<DIV class=galleria-container style="HEIGHT: 500px" jQuery1285689732952="5">
<DIV class=galleria-stage>
<DIV class=galleria-images style="LEFT: 0px; WIDTH: 100%; POSITION: relative; TOP: 0px; HEIGHT: 100%">
<DIV class=galleria-image style="LEFT: 0px; OVERFLOW: hidden; POSITION: absolute; TOP: 0px"></DIV>
<DIV class=galleria-image style="LEFT: 0px; OVERFLOW: hidden; POSITION: absolute; TOP: 0px"><IMG style="DISPLAY: block; LEFT: -10000px; POSITION: absolute" height=528 src="file:///C:/Documents%20and%20Settings/Administrator/Desktop/goranphoto.com-beta/galleries/editorial/1.jpg" width=800></DIV></DIV>
<DIV class=galleria-loader style="DISPLAY: block; FILTER: alpha(opacity=40); ZOOM: 1" jQuery1285689732952="8"></DIV>
<DIV class=galleria-counter style="DISPLAY: none; FILTER: alpha(opacity=40); ZOOM: 1" jQuery1285689732952="9"><SPAN class=current>-</SPAN>/ <SPAN class=total>4</SPAN></DIV>
<DIV class=galleria-image-nav style="DISPLAY: block; LEFT: -10000px; POSITION: absolute">
<DIV class=galleria-image-nav-right style="DISPLAY: none" jQuery1285689732952="6"></DIV>
<DIV class=galleria-image-nav-left style="DISPLAY: none" jQuery1285689732952="7"></DIV></DIV></DIV>
<DIV class=galleria-thumbnails-container>
<DIV class=galleria-thumb-nav-left></DIV>
<DIV class=galleria-thumbnails-list>
<DIV class=galleria-thumbnails style="FILTER: alpha(opacity=100); ZOOM: 1"></DIV></DIV>
<DIV class=galleria-thumb-nav-right></DIV></DIV>
<DIV class=galleria-info>
<DIV class=galleria-info-text jQuery1285689732952="10">
<DIV class=galleria-info-title></DIV>
<DIV class=galleria-info-description></DIV>
<DIV class=galleria-info-author></DIV></DIV>
<DIV class=galleria-info-link jQuery1285689732952="11"></DIV>
<DIV class=galleria-info-close jQuery1285689732952="12"></DIV></DIV></DIV></DIV>
<DIV id=controls style="DISPLAY: block"><A id=g_next href="#" jQuery1285689732952="14">NEXT</A><BR><A id=g_prev href="#" jQuery1285689732952="13">PREV</A><BR><A id=g_play href="#" jQuery1285689732952="15">PLAY</A><BR><A id=g_pause href="#" jQuery1285689732952="16">PAUSE</A> </DIV>
<DIV id=leftfooter>EDITORIAL<BR>COMMERCIAL<BR>CONTACT<BR>BIO<BR>EXHIBITIONS </DIV>
<DIV id=rightfooter>right footer</DIV></DIV>
<SCRIPT>
$('.images').galleria({
thumbnails:false,
height:500,
preload:2,
image_position:'right',
image_margin:0,
show_imagenav:false,
data_config: function(img) {
// will extract and return image captions from the source:
return {
title: $(img).parent().next('strong').html(),
description: $(img).parent().next('strong').next().html()
};
},
extend: function() {
var gallery = this; // save the scope
$('#nav a').click(function(e) {
e.preventDefault(); // prevent default actions on the links
})
// attach gallery methods to links:
$('#g_prev').click(function() {
gallery.prev();
});
$('#g_next').click(function() {
gallery.next();
});
$('#g_play').click(function() {
gallery.play();
});
$('#g_pause').click(function() {
gallery.pause();
});
}

});
</SCRIPT>
</BODY></HTML>

milosevic

8:28 am on Sep 29, 2010 (gmt 0)

10+ Year Member



Wish I could help you krko but I'm not a JavaScript guru by any means and this is beyond me - I've also got no experience with this galleria script.

I'd suggest making a new thread in the JavaScript forum - it seems likely to me that this is not a CSS issue (or only indirectly through JavaScript if it is).

One thing to check though, have you tried completely removing the reference to the theme file but leaving the main galleria script in to see what happens?

krko

8:54 am on Sep 29, 2010 (gmt 0)

10+ Year Member



Milosevic, thank you very much. Removing the reference to the theme file makes everything go wrong... :)
Does anyone have some other suggestions?

krko

4:32 pm on Sep 29, 2010 (gmt 0)

10+ Year Member



I found a solution!
I'm posting so someone in the future will benefit from it perhaps.
The solution is to do the steps I detailed above and add a simple height:100% in the css file to .galleria-stage.

Also, IE6 has problems with position:fixed so the first thing to do would be to change this to position:absolute if your galleria theme has any of these.

That's it!

Works in IE6, IE7 and IE8 :)

HUGE THANKS GOES TO SEBASTIAN KOCH FROM ILEXIUS 3D ANIMATION!