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

Bug: 有a标签的情况下无法滑动到下一张! #426

Open
havingmeaning opened this issue Nov 10, 2017 · 1 comment
Open

Bug: 有a标签的情况下无法滑动到下一张! #426

havingmeaning opened this issue Nov 10, 2017 · 1 comment

Comments

@havingmeaning
Copy link

Example:
list.push({
content: <div class="rec-silder-cell"> <a href="${this.recommends[i].linkUrl}"> <img src="${this.recommends[i].picUrl}" /> </a> </div>
});
如果有a标签的话,在我滑动到下一张的过程中,页面直接发生跳转。
其实我想要的效果,就是在我滑动的时候,页面不要应该发生跳转。而页面发生跳转的时候,仅仅只是我点击的时候!

@havingmeaning
Copy link
Author

havingmeaning commented Nov 10, 2017

It is very easy! We can use flag to work out this problem!
My code:

var isLinkTo = 1;
var S = new iSlider(document.getElementById('rec-silder'), list, {
isAutoplay: 0,
isLooping: 1,
isOverspread: false,
animateTime: 800,
plugins: ['dot'],
renderComplete: function () {
},
onSlideStart: function (e) {
isLinkTo = 1;
},
onSlide: function (e) {
isLinkTo = 0;
},
onSlideEnd: function (e) {
if (isLinkTo === 1) {
window.location.href = "www.baidu.com";
}
}
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant