FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Problem with hover over images in slimbox.js





mccollinsdesign
I am developing a site in Joomla and have used an extension called ‘image browser’ to display a gallery. The image browser extension is made from slimbox.js.

I have inserted PayPal buttons into the caption so they display when you click the image, but I am trying to break the tooltips that pop up showing the HTML code when you hover over an image.

It is too late to switch to another gallery, and I have viewed a few different posts on this subject but none of them uses slimbox.js, they all use light box, and that hasn't helped me.

The website is http://www.whiteriverphotography.net
Any help would be appreciated.
P.S. I am completely clueless when is comes to scripting. Conceptually I understand how it works, but dont know any of the language.

Code:

/*
Slimbox v1.41 - The ultimate lightweight Lightbox clone
by Christophe Beyls (http://www.digitalia.be) - MIT-style license.
Inspired by the original Lightbox v2 by Lokesh Dhakar.
*/
var Lightbox = {
init: function(options){
this.options = $extend({
resizeDuration: 400,
resizeTransition: false, // default transition
initialWidth: 250,
initialHeight: 250,
animateCaption: true,
showCounter: true
}, options || {});
this.anchors = [];
$each(document.links, function(el){
if (el.rel && el.rel.test(/^lightbox/i)){
el.onclick = this.click.pass(el, this);
this.anchors.push(el);
}
}, this);
this.eventKeyDown = this.keyboardListener.bindAsEventListener(this);
this.eventPosition = this.position.bind(this);
this.overlay = new Element('div', {'id': 'lbOverlay'}).injectInside(document.body);
this.center = new Element('div', {'id': 'lbCenter', 'styles': {'width': this.options.initialWidth, 'height': this.options.initialHeight, 'marginLeft': -(this.options.initialWidth/2), 'display': 'none'}}).injectInside(document.body);
this.image = new Element('div', {'id': 'lbImage'}).injectInside(this.center);
this.prevLink = new Element('a', {'id': 'lbPrevLink', 'href': '#', 'styles': {'display': 'none'}}).injectInside(this.image);
this.nextLink = this.prevLink.clone().setProperty('id', 'lbNextLink').injectInside(this.image);
this.prevLink.onclick = this.previous.bind(this);
this.nextLink.onclick = this.next.bind(this);
this.bottomContainer = new Element('div', {'id': 'lbBottomContainer', 'styles': {'display': 'none'}}).injectInside(document.body);
this.bottom = new Element('div', {'id': 'lbBottom'}).injectInside(this.bottomContainer);
new Element('a', {'id': 'lbCloseLink', 'href': '#'}).injectInside(this.bottom).onclick = this.overlay.onclick = this.close.bind(this);
this.caption = new Element('div', {'id': 'lbCaption'}).injectInside(this.bottom);
this.number = new Element('div', {'id': 'lbNumber'}).injectInside(this.bottom);
new Element('div', {'styles': {'clear': 'both'}}).injectInside(this.bottom);
var nextEffect = this.nextEffect.bind(this);
this.fx = {
overlay: this.overlay.effect('opacity', {duration: 500}).hide(),
resize: this.center.effects($extend({duration: this.options.resizeDuration, onComplete: nextEffect}, this.options.resizeTransition ? {transition: this.options.resizeTransition} : {})),
image: this.image.effect('opacity', {duration: 500, onComplete: nextEffect}),
bottom: this.bottom.effect('margin-top', {duration: 400, onComplete: nextEffect})
};
this.preloadPrev = new Image();
this.preloadNext = new Image();
},
click: function(link){
if (link.rel.length == 8) return this.show(link.href, link.title);
var j, imageNum, images = [];
this.anchors.each(function(el){
if (el.rel == link.rel){
for (j = 0; j < images.length; j++) if(images[j][0] == el.href) break;
if (j == images.length){
images.push([el.href, el.title]);
if (el.href == link.href) imageNum = j;
}
}
}, this);
return this.open(images, imageNum);
},
show: function(url, title){
return this.open([[url, title]], 0);
},
open: function(images, imageNum){
this.images = images;
this.position();
this.setup(true);
this.top = window.getScrollTop() + (window.getHeight() / 15);
this.center.setStyles({top: this.top, display: ''});
this.fx.overlay.start(0.8);
return this.changeImage(imageNum);
},
position: function(){
this.overlay.setStyles({'top': window.getScrollTop(), 'height': window.getHeight()});
},
setup: function(open){
var elements = $A(document.getElementsByTagName('object'));
elements.extend(document.getElementsByTagName(window.ie ? 'select' : 'embed'));
elements.each(function(el){
if (open) el.lbBackupStyle = el.style.visibility;
el.style.visibility = open ? 'hidden' : el.lbBackupStyle;
});
var fn = open ? 'addEvent' : 'removeEvent';
window[fn]('scroll', this.eventPosition)[fn]('resize', this.eventPosition);
document[fn]('keydown', this.eventKeyDown);
this.step = 0;
},
keyboardListener: function(event){
switch (event.keyCode){
case 27: case 88: case 67: this.close(); break;
case 37: case 80: this.previous(); break;
case 39: case 78: this.next();
}
},
previous: function(){
return this.changeImage(this.activeImage-1);
},
next: function(){
return this.changeImage(this.activeImage+1);
},
changeImage: function(imageNum){
if (this.step || (imageNum < 0) || (imageNum >= this.images.length)) return false;
this.step = 1;
this.activeImage = imageNum;
this.bottomContainer.style.display = this.prevLink.style.display = this.nextLink.style.display = 'none';
this.fx.image.hide();
this.center.className = 'lbLoading';
this.preload = new Image();
this.preload.onload = this.nextEffect.bind(this);
this.preload.src = this.images[imageNum][0];
return false;
},
nextEffect: function(){
switch (this.step++){
case 1:
this.center.className = '';
this.image.style.backgroundImage = 'url('+this.images[this.activeImage][0]+')';
this.image.style.width = this.bottom.style.width = this.preload.width+'px';
this.image.style.height = this.prevLink.style.height = this.nextLink.style.height = this.preload.height+'px';
this.caption.setHTML(this.images[this.activeImage][1] || '');
this.number.setHTML((!this.options.showCounter || (this.images.length == 1)) ? '' : 'Image '+(this.activeImage+1)+' of '+this.images.length);
if (this.activeImage) this.preloadPrev.src = this.images[this.activeImage-1][0];
if (this.activeImage != (this.images.length - 1)) this.preloadNext.src = this.images[this.activeImage+1][0];
if (this.center.clientHeight != this.image.offsetHeight){
this.fx.resize.start({height: this.image.offsetHeight});
break;
}
this.step++;
case 2:
if (this.center.clientWidth != this.image.offsetWidth){
this.fx.resize.start({width: this.image.offsetWidth, marginLeft: -this.image.offsetWidth/2});
break;
}
this.step++;
case 3:
this.bottomContainer.setStyles({top: this.top + this.center.clientHeight, height: 0, marginLeft: this.center.style.marginLeft, display: ''});
this.fx.image.start(1);
break;
case 4:
if (this.options.animateCaption){
this.fx.bottom.set(-this.bottom.offsetHeight);
this.bottomContainer.style.height = '';
this.fx.bottom.start(0);
break;
}
this.bottomContainer.style.height = '';
case 5:
if (this.activeImage) this.prevLink.style.display = '';
if (this.activeImage != (this.images.length - 1)) this.nextLink.style.display = '';
this.step = 0;
}
},
close: function(){
if (this.step < 0) return;
this.step = -1;
if (this.preload){
this.preload.onload = Class.empty;
this.preload = null;
}
for (var f in this.fx) this.fx[f].stop();
this.center.style.display = this.bottomContainer.style.display = 'none';
this.fx.overlay.chain(this.setup.pass(false, this)).start(0);
return false;
}
};
window.addEvent('domready', Lightbox.init.bind(Lightbox));
sonam
I don't know nothing about this script but when I am looking in your code there is missing one quote after title (Red-tailed Hawk) and I think this is cause problem. BTW very nice site.

<a href="images/stories/imagebrowser/BirdsofPrey/RedtailedHawk 16.jpg" rel="lightbox[]" title="Red-tailed Hawk"
<form target=" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <img src="/images/stories/imagebrowser/BirdsofPrey//thumb/RedtailedHawk 16.jpg" class="thumbnail" alt="RedtailedHawk 16.jpg" border="0">
</a>

Sonam

Edit: remove code bracket because color is not working Smile
gabrielcastillo
I have the same problem with a light box for my site. I havent figure it out yet but I will PM you when I do. I used php in my title tag to display a link when image pops up. Now I get the html code for my link displayed on hover.

I'm sure there is a fix for this or some thing to work around it. good luck.
mccollinsdesign
I would appreciate that greatly, as this has been a thorn in my side for a few weeks, i finally decided to just start learning javascript.
mccollinsdesign
As far as the HTML code, joomla automates that, so its an issue with joomla probably as far as the missing quote. Thanks for the reply, and the compliment.
Related topics
Crazy Idea #847
FriH points and FRIH$
Problems with my coding... again
problem with my internet explorer
The Hangout
Submit Button Change
personal site for school - what do you think?
Flash 8 Roll over images
links dont work in IE from frihost hosted site
Help wanted with CSS and iframes It works
CSS a:hover and tables problem. Help really needed?
hover opacity links not working in IE but ok in Safari
My Floats are faulty....
Javascript navbar going under lightbox
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.