Skip to content
Browse files

fixed scoping problem with links

  • Loading branch information...
1 parent e9951c7 commit 2db4bb811c331406f7cb6d4885c99845dcbe64af @davidhellsing davidhellsing committed Apr 20, 2011
Showing with 61 additions and 56 deletions.
  1. +57 −54 src/galleria.js
  2. +4 −2 src/themes/classic/classic-demo.html
View
111 src/galleria.js
@@ -1,5 +1,5 @@
/**
- * @preserve Galleria v 1.2.3 2011-04-14
+ * @preserve Galleria v 1.2.3 2011-04-20
* http://galleria.aino.se
*
* Copyright (c) 2011, Aino
@@ -3002,74 +3002,77 @@ this.prependChild( 'info', 'myElement' );
thumb = this._thumbnails[ queue.index ];
// to be fired when loading & transition is complete:
- var complete = function() {
+ var complete = (function( data, next, active, queue, thumb ) {
+
+ return function() {
- var win;
+ var win;
- // remove stalled
- self._queue.stalled = false;
+ // remove stalled
+ self._queue.stalled = false;
- // optimize quality
- Utils.toggleQuality( next.image, self._options.imageQuality );
+ // optimize quality
+ Utils.toggleQuality( next.image, self._options.imageQuality );
- // swap
- $( active.container ).css({
- zIndex: 0,
- opacity: 0
- });
- $( next.container ).css({
- zIndex: 1,
- opacity: 1
- });
- self._controls.swap();
+ // swap
+ $( active.container ).css({
+ zIndex: 0,
+ opacity: 0
+ });
+ $( next.container ).css({
+ zIndex: 1,
+ opacity: 1
+ });
+ self._controls.swap();
- // add pan according to option
- if ( self._options.imagePan ) {
- self.addPan( next.image );
- }
+ // add pan according to option
+ if ( self._options.imagePan ) {
+ self.addPan( next.image );
+ }
- // make the image link or add lightbox
- // link takes precedence over lightbox if both are detected
- if ( data.link || self._options.lightbox ) {
+ // make the image link or add lightbox
+ // link takes precedence over lightbox if both are detected
+ if ( data.link || self._options.lightbox ) {
- $( next.image ).css({
- cursor: 'pointer'
- }).bind( CLICK(), function() {
+ $( next.image ).css({
+ cursor: 'pointer'
+ }).bind( CLICK(), function() {
- // popup link
- if ( data.link ) {
- if ( self._options.popupLinks ) {
- win = window.open( data.link, '_blank' );
- } else {
- window.location.href = data.link;
+ // popup link
+ if ( data.link ) {
+ if ( self._options.popupLinks ) {
+ win = window.open( data.link, '_blank' );
+ } else {
+ window.location.href = data.link;
+ }
+ return;
}
- return;
- }
- self.openLightbox();
+ self.openLightbox();
- });
- }
+ });
+ }
- // remove the queued image
- Array.prototype.shift.call( self._queue );
+ // remove the queued image
+ Array.prototype.shift.call( self._queue );
- // if we still have images in the queue, show it
- if ( self._queue.length ) {
- self._show();
- }
+ // if we still have images in the queue, show it
+ if ( self._queue.length ) {
+ self._show();
+ }
- // check if we are playing
- self._playCheck();
+ // check if we are playing
+ self._playCheck();
- // trigger IMAGE event
- self.trigger({
- type: Galleria.IMAGE,
- index: queue.index,
- imageTarget: next.image,
- thumbTarget: thumb.image
- });
- };
+ // trigger IMAGE event
+ self.trigger({
+ type: Galleria.IMAGE,
+ index: queue.index,
+ imageTarget: next.image,
+ thumbTarget: thumb.image
+ });
+ };
+ }( data, next, active, queue, thumb ));
// let the carousel follow
if ( this._options.carousel && this._options.carouselFollow ) {
View
6 src/themes/classic/classic-demo.html
@@ -37,7 +37,8 @@
<a href="http://upload.wikimedia.org/wikipedia/commons/thumb/3/34/Locomotives-Roundhouse2.jpg/1000px-Locomotives-Roundhouse2.jpg">
<img title="Locomotives Roundhouse"
alt="Steam locomotives of the Chicago &amp; North Western Railway."
- src="http://upload.wikimedia.org/wikipedia/commons/thumb/3/34/Locomotives-Roundhouse2.jpg/100px-Locomotives-Roundhouse2.jpg">
+ src="http://upload.wikimedia.org/wikipedia/commons/thumb/3/34/Locomotives-Roundhouse2.jpg/100px-Locomotives-Roundhouse2.jpg"
+ longdesc="http://aino.se">
</a>
<a href="http://upload.wikimedia.org/wikipedia/commons/thumb/3/36/Icebergs_in_the_High_Arctic_-_20050907.jpg/1000px-Icebergs_in_the_High_Arctic_-_20050907.jpg">
<img title="Icebergs in the High Arctic"
@@ -47,7 +48,8 @@
<a href="http://upload.wikimedia.org/wikipedia/commons/thumb/f/fe/Ara%C3%B1a._A_Estrada%2C_Galiza._02.jpg/1000px-Ara%C3%B1a._A_Estrada%2C_Galiza._02.jpg">
<img title="Araña"
alt="Xysticus cristatus, A Estrada, Galicia, Spain"
- src="http://upload.wikimedia.org/wikipedia/commons/thumb/f/fe/Ara%C3%B1a._A_Estrada%2C_Galiza._02.jpg/100px-Ara%C3%B1a._A_Estrada%2C_Galiza._02.jpg">
+ src="http://upload.wikimedia.org/wikipedia/commons/thumb/f/fe/Ara%C3%B1a._A_Estrada%2C_Galiza._02.jpg/100px-Ara%C3%B1a._A_Estrada%2C_Galiza._02.jpg"
+ longdesc="http://google.se">
</a>
<a href="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/9104_-_Milano_-_Museo_storia_naturale_-_Fluorite_-_Foto_Giovanni_Dall%27Orto_22-Apr-2007.jpg/1000px-9104_-_Milano_-_Museo_storia_naturale_-_Fluorite_-_Foto_Giovanni_Dall%27Orto_22-Apr-2007.jpg">
<img title="Museo storia naturale"

0 comments on commit 2db4bb8

Please sign in to comment.
Something went wrong with that request. Please try again.