Skip to content

Commit

Permalink
Merge pull request #192 from xieyu33333/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
xieyu33333 committed Mar 16, 2015
2 parents 4a14dff + 0996106 commit 30d6c05
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 1 deletion.
14 changes: 14 additions & 0 deletions build/islider.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,19 @@ iSlider = function () {
var res = this._endHandler ? this._endHandler(evt) : false;
var absOffset = Math.abs(offset[axis]);
var absReverseOffset = Math.abs(offset[this.reverseAxis]);
var getLink = function (el) {
console.log(el);
if (el.tagName === 'A') {
if (el.href) {
window.location.href = el.href;
return false;
}
} else if (el.className === 'islider-dom') {
return false;
} else {
getLink(el.parentNode);
}
};
if (!res && offset[axis] >= boundary && absReverseOffset < absOffset) {
this.slideTo(this.slideIndex - 1);
} else if (!res && offset[axis] < -boundary && absReverseOffset < absOffset) {
Expand All @@ -525,6 +538,7 @@ iSlider = function () {
if (Math.abs(this.offset.X) < 10 && Math.abs(this.offset.Y) < 10) {
this.tapEvt = document.createEvent('Event');
this.tapEvt.initEvent('tap', true, true);
getLink(evt.target);
if (!evt.target.dispatchEvent(this.tapEvt)) {
evt.preventDefault();
}
Expand Down
14 changes: 14 additions & 0 deletions build/islider_core.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,19 @@ iSlider = function () {
var res = this._endHandler ? this._endHandler(evt) : false;
var absOffset = Math.abs(offset[axis]);
var absReverseOffset = Math.abs(offset[this.reverseAxis]);
var getLink = function (el) {
console.log(el);
if (el.tagName === 'A') {
if (el.href) {
window.location.href = el.href;
return false;
}
} else if (el.className === 'islider-dom') {
return false;
} else {
getLink(el.parentNode);
}
};
if (!res && offset[axis] >= boundary && absReverseOffset < absOffset) {
this.slideTo(this.slideIndex - 1);
} else if (!res && offset[axis] < -boundary && absReverseOffset < absOffset) {
Expand All @@ -525,6 +538,7 @@ iSlider = function () {
if (Math.abs(this.offset.X) < 10 && Math.abs(this.offset.Y) < 10) {
this.tapEvt = document.createEvent('Event');
this.tapEvt.initEvent('tap', true, true);
getLink(evt.target);
if (!evt.target.dispatchEvent(this.tapEvt)) {
evt.preventDefault();
}
Expand Down
14 changes: 14 additions & 0 deletions demo/public/js/islider.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,19 @@ iSlider = function () {
var res = this._endHandler ? this._endHandler(evt) : false;
var absOffset = Math.abs(offset[axis]);
var absReverseOffset = Math.abs(offset[this.reverseAxis]);
var getLink = function (el) {
console.log(el);
if (el.tagName === 'A') {
if (el.href) {
window.location.href = el.href;
return false;
}
} else if (el.className === 'islider-dom') {
return false;
} else {
getLink(el.parentNode);
}
};
if (!res && offset[axis] >= boundary && absReverseOffset < absOffset) {
this.slideTo(this.slideIndex - 1);
} else if (!res && offset[axis] < -boundary && absReverseOffset < absOffset) {
Expand All @@ -525,6 +538,7 @@ iSlider = function () {
if (Math.abs(this.offset.X) < 10 && Math.abs(this.offset.Y) < 10) {
this.tapEvt = document.createEvent('Event');
this.tapEvt.initEvent('tap', true, true);
getLink(evt.target);
if (!evt.target.dispatchEvent(this.tapEvt)) {
evt.preventDefault();
}
Expand Down
14 changes: 14 additions & 0 deletions demo/public/js/islider_core.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,19 @@ iSlider = function () {
var res = this._endHandler ? this._endHandler(evt) : false;
var absOffset = Math.abs(offset[axis]);
var absReverseOffset = Math.abs(offset[this.reverseAxis]);
var getLink = function (el) {
console.log(el);
if (el.tagName === 'A') {
if (el.href) {
window.location.href = el.href;
return false;
}
} else if (el.className === 'islider-dom') {
return false;
} else {
getLink(el.parentNode);
}
};
if (!res && offset[axis] >= boundary && absReverseOffset < absOffset) {
this.slideTo(this.slideIndex - 1);
} else if (!res && offset[axis] < -boundary && absReverseOffset < absOffset) {
Expand All @@ -525,6 +538,7 @@ iSlider = function () {
if (Math.abs(this.offset.X) < 10 && Math.abs(this.offset.Y) < 10) {
this.tapEvt = document.createEvent('Event');
this.tapEvt.initEvent('tap', true, true);
getLink(evt.target);
if (!evt.target.dispatchEvent(this.tapEvt)) {
evt.preventDefault();
}
Expand Down
18 changes: 17 additions & 1 deletion src/islider_core.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,22 @@ define('iSlider', [], function () {
var absOffset = Math.abs(offset[axis]);
var absReverseOffset = Math.abs(offset[this.reverseAxis]);

var getLink = function(el) {
console.log(el);
if (el.tagName === 'A') {
if (el.href) {
window.location.href = el.href
return false;
}
}
else if (el.className === 'islider-dom') {
return false;
}
else {
getLink(el.parentNode);
}
}

if (!res && offset[axis] >= boundary && absReverseOffset < absOffset) {
this.slideTo(this.slideIndex - 1);
} else if (!res && offset[axis] < -boundary && absReverseOffset < absOffset) {
Expand All @@ -589,7 +605,7 @@ define('iSlider', [], function () {
if (Math.abs(this.offset.X) < 10 && Math.abs(this.offset.Y) < 10) {
this.tapEvt = document.createEvent('Event');
this.tapEvt.initEvent('tap', true, true);

getLink(evt.target);
if (!evt.target.dispatchEvent(this.tapEvt)) {
evt.preventDefault();
}
Expand Down

0 comments on commit 30d6c05

Please sign in to comment.