Skip to content

Commit

Permalink
fixed disabled links to work with nested linking
Browse files Browse the repository at this point in the history
  • Loading branch information
mmonkey committed Feb 20, 2015
1 parent bdbcc42 commit 2c716ce
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
20 changes: 18 additions & 2 deletions build/js/fireSlider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! fireSlider (1.2.61) (C) 2014 CJ O'Hara and Tyler Fowle. MIT @license: en.wikipedia.org/wiki/MIT_License */
/*! fireSlider (1.2.62) (C) 2014 CJ O'Hara and Tyler Fowle. MIT @license: en.wikipedia.org/wiki/MIT_License */
var V = (window.jQuery) ? $.Velocity : Velocity;

(function (FireSlider, window, undefined) {
Expand Down Expand Up @@ -663,7 +663,14 @@ var V = (window.jQuery) ? $.Velocity : Velocity;
fireSlider._utilities.listen(fs.slider, 'click', function(e) {
var target = (e.target) ? e.target : e.srcElement;
if(target.tagName === "A") {
if(!fireSlider._utilities.hasClass(target.parentNode, fs.options.activeSlideClass)) {
var parents = fireSlider._utilities.getParents(target);
var isActive = false;
for(var i = 0; i < parents.length; i++) {
if(fireSlider._utilities.hasClass(parents[i], fs.options.activeSlideClass)) {
isActive = true;
}
}
if(!isActive) {
if (e.preventDefault) e.preventDefault();
else e.returnValue = false;
}
Expand Down Expand Up @@ -871,6 +878,15 @@ var V = (window.jQuery) ? $.Velocity : Velocity;
return ret;
},

getParents: function(elm) {
var results = [];
while(elm.parentNode) {
results.push(elm.parentNode);
elm = elm.parentNode;
}
return results;
},

// Gets the index of a DOM element relative to it's parent element
getIndex: function(node) {
var result = -1;
Expand Down
4 changes: 2 additions & 2 deletions dist/fireSlider.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/fireSlider.velocity.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var gulp = require('gulp'),
uglify = require('gulp-uglify'),
util = require('gulp-util');

var version = '1.2.6';
var version = '1.2.62';
var versionComment = '/*! fireSlider (' + version + ') (C) 2014 CJ O\'Hara and Tyler Fowle. MIT @license: en.wikipedia.org/wiki/MIT_License */\n';
var velocityComment = '/*! VelocityJS.org (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */\n/*! VelocityJS.org jQuery Shim (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */\n';
var velocity = 'var Velocity = require(\'velocity-animate\');\n';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fireSlider.js",
"version": "v1.2.61",
"version": "v1.2.62",
"description": "A responsive javascript slider and carousel plugin, with breakpoints",
"repository": {
"type": "git",
Expand Down

0 comments on commit 2c716ce

Please sign in to comment.