Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

honour description; new options #53

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ I will exclude the UL wrapper and only show the HTML necessary for a single pane
3) Slideshow with panel overlays

<li>
<img src="../gv/path/to/image.jpg" alt="image" title="Pretty Picture" data-description="Some more information about the photo" />
<img src="../gv/path/to/image.jpg" alt="image" title="Pretty Picture" description="Some more information about the photo" />
</li>

For this gallery, the contents of the title and data-description attributes will display on top of the panel image, its position determined by the
For this gallery, the contents of the title and description attributes will display on top of the panel image, its position determined by the
'overlay_position' option. The color of the overlays are set in the included CSS file.

CREATING/USING CUSTOM NAVIGATION THEMES
Expand Down
6 changes: 5 additions & 1 deletion css/jquery.galleryview-3.0-dev.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@
/** FILMSTRIP STYLES **/
/*************************************************/

.gv_filmstripWrap { overflow: hidden; position: absolute; }
.gv_filmstripWrap {
overflow: hidden;
position: absolute;
z-index: 2;
}


/* FILMSTRIP */
Expand Down
41 changes: 34 additions & 7 deletions js/jquery.galleryview-3.0-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if (typeof Object.create !== 'function') {
this.width = 0;
this.attrs = {
title: img.attr('title') || img.attr('alt'),
description: img.data('description')
description: img.attr('description')
};
this.href = null;
this.dom_obj = null;
Expand Down Expand Up @@ -230,7 +230,6 @@ if (typeof Object.create !== 'function') {
});



$.each(this.gvImages,function(i,img) {
dom.gv_panelWrap.append(dom.gv_panel.clone(true));
});
Expand Down Expand Up @@ -428,9 +427,11 @@ if (typeof Object.create !== 'function') {
});
}
dom.gv_frames = dom.gv_filmstrip.find('.gv_frame');

$.each(dom.gv_frames,function(i,frame) {
$(frame).data('frameIndex',i);
});

dom.gv_thumbnails = dom.gv_filmstrip.find('div.gv_thumbnail');
},

Expand Down Expand Up @@ -617,25 +618,43 @@ if (typeof Object.create !== 'function') {

this.updateOverlay(i);


this.iterator = i;
this.updateFilmstrip(frame_i);
this.showInfoBar();


},

autoShowOverlay: function(i) {
if (this.opts.overlay_visible == "auto") {
if (
this.gvImages[i].attrs.description.replace(/^\s+|\s+$/g, '') != '' &&
this.gvImages[i].attrs.title.replace(/^\s+|\s+$/g, '') != ''
)
this.showOverlay()
else
this.hideOverlay()

} else if (this.opts.overlay_visible) {
this.showOverlay()
}
},

updateOverlay: function(i) {
var self = this,
dom = this.dom;

if(this.overlayVisible) {
this.hideOverlay(null,function(){
dom.gv_overlay.html('<h4>'+self.gvImages[i].attrs.title+'</h4><p>'+self.gvImages[i].attrs.description+'</p>');
self.showOverlay();
if (self.opts.overlay_visible == true) self.showOverlay();
self.autoShowOverlay(i);
});
} else {
dom.gv_overlay.html('<h4>'+self.gvImages[i].attrs.title+'</h4><p>'+self.gvImages[i].attrs.description+'</p>');
dom.gv_overlay.css(this.opts.overlay_position,-1 * dom.gv_overlay.outerHeight());
dom.gv_overlay.css(self.opts.overlay_position,-1 * dom.gv_overlay.outerHeight());
self.autoShowOverlay(i);
}

},
Expand Down Expand Up @@ -929,6 +948,7 @@ if (typeof Object.create !== 'function') {
});

// create all necessary DOM elements

$.each(this.elems,function(i,elem) {
var elem = elem.split('.');

Expand Down Expand Up @@ -956,6 +976,7 @@ if (typeof Object.create !== 'function') {
}
if(this.opts.show_infobar) {
dom.gv_panelWrap.append(dom.gv_infobar);
dom.gv_infobar.addClass(this.opts.overlay_classes)
}
}

Expand All @@ -978,11 +999,13 @@ if (typeof Object.create !== 'function') {
}

if(this.opts.enable_overlays) {
dom.gv_panelWrap.append(dom.gv_overlay,dom.gv_showOverlay);
dom.gv_panelWrap.append(dom.gv_overlay,dom.gv_showOverlay);
dom.gv_showOverlay.addClass(this.opts.overlay_classes)
dom.gv_overlay.addClass(this.opts.overlay_classes)
}

if(this.opts.show_captions) {
dom.gv_frame.append(dom.gv_caption).appendTo(dom.gv_gallery);
dom.gv_frame.append(dom.gv_caption).appendTo(dom.gv_gallery);
}

//swap out source element with gallery
Expand Down Expand Up @@ -1010,11 +1033,13 @@ if (typeof Object.create !== 'function') {
// show gallery
dom.gv_galleryWrap.show();


if(this.opts.autoplay) {
this.startSlideshow(true);
}

this.updateOverlay(this.iterator);

this.updateFilmstrip(this.frameIterator);
}

Expand Down Expand Up @@ -1074,6 +1099,8 @@ if (typeof Object.create !== 'function') {

// Info Bar Options
show_infobar: true, //BOOLEAN - flag to show or hide infobar
infobar_opacity: 1 //FLOAT - transparency for info bar
infobar_opacity: 1, //FLOAT - transparency for info bar
overlay_classes: '', //STRING - Extra class(es) to add to overlay / info bar / etc
overlay_visible: false //BOOLEAN - overlay visibility at load
};
})(jQuery);