Skip to content

Commit

Permalink
Update to add clickable links. Added updateClickable method, new opti…
Browse files Browse the repository at this point in the history
…ons, updateClickable binding, and this.href setting.
  • Loading branch information
joeletherton committed Jun 26, 2012
1 parent e240471 commit 592f621
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions js/jquery.galleryview-3.0-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if (typeof Object.create !== 'function') {
title: img.attr('title') || img.attr('alt'),
description: img.data('description')
};
this.href = null;
this.href = img.data('href'); // Important for clickable links
this.dom_obj = null;

return this;
Expand Down Expand Up @@ -908,6 +908,34 @@ if (typeof Object.create !== 'function') {
dom.gv_panelNavPrev.hide();
},

// Added to provide clickable link support for panels
updateClickable: function(i) {
var self = this,
dom = this.dom;

href = self.gvImages[i].href;

if(href != '')
{
var action;

if (this.opts.link_newwindow){
action = function(){
window.open(href, "_blank");
};
}
else {
action = function(){
window.location = href;
};
}

dom.gv_panelWrap.delegate('.gv_panel','click.galleryview', action);
}

return false;
},

init: function(options,el) {
var self = this,
dom = this.dom = {};
Expand Down Expand Up @@ -1014,6 +1042,11 @@ if (typeof Object.create !== 'function') {
this.startSlideshow(true);
}

// if panels should be clickable - set it up
if(this.opts.panel_clickable){
this.updateClickable(this.iterator);
}

this.updateOverlay(this.iterator);
this.updateFilmstrip(this.frameIterator);
}
Expand Down Expand Up @@ -1055,7 +1088,9 @@ if (typeof Object.create !== 'function') {
pan_images: false, //BOOLEAN - flag to allow user to grab/drag oversized images within gallery
pan_style: 'drag', //STRING - panning method (drag = user clicks and drags image to pan, track = image automatically pans based on mouse position
pan_smoothness: 15, //INT - determines smoothness of tracking pan animation (higher number = smoother)

link_newwindow: true, //BOOLEAN - flag to open clickable images in a new window
panel_clickable: false, //BOOLEAN - flag to determine if the panel is clickable

// Filmstrip Options
start_frame: 1, //INT - index of panel/frame to show first when gallery loads
show_filmstrip: true, //BOOLEAN - flag to show or hide filmstrip portion of gallery
Expand Down

4 comments on commit 592f621

@knijia
Copy link

@knijia knijia commented on 592f621 Jul 10, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Joel, i can see you're concerned about the href in galleryview but do you know if it's possible to have the href also with the infobar inside the gv_overlay, for example with the h4 tag of the title ?

@joeletherton
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made some updates locally that I'm testing. When I get home later tonight I'll probably post them to my public site to test them remotely and then make a new commit. I'll let you know when I push it public.

@joeletherton
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@knijia: I've just made a commit with new source. It removes the "panel_clickable" option and changes it to "clickable". You can specify 'all', 'panel', 'overlay', or 'none' (default is 'none'). This will make the h4 tag behave as a link as well.

@knijia
Copy link

@knijia knijia commented on 592f621 Jul 11, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly what i needed Joel, great job ! It's more obvious for users to click on the text link when galleryview is used as a featured posts gallery as i do. And with the new way, no more hesitation, the entire panel can be linked. ;-)

Please sign in to comment.