我试着用bootstrap4 carousel做两个步骤
在使用javascript代码转到下一张幻灯片之前,我想检查用户id和密码是否有效。我有.carousel('pause'),但是我不能阻止移动到下一张幻灯片。另外,我不想有一个额外的按钮来检查内容。
$('#myCarousel').on('slide.bs.carousel', function (e) {
// authentication check here
if (isAuth === false)
{
// stay on this slide
}
else
{
// move the next one
}
})有办法这样做吗?
注意:我通过设置data-interval="false"禁用了自动滑动。用户手动在幻灯片之间导航,即通过单击或箭头键导航。
发布于 2017-09-14 18:30:28
发布于 2017-05-11 12:53:46
使用这种方式:
$('#myCarousel').on('slide.bs.carousel', function (e) {
// authentication check here
if (isAuth === false)
{
$('#myCarousel').carousel('pause');
return false; // stay on this slide
}
else
{
$('#myCarousel').carousel('cycle');
return true; // move the next one
}})
https://stackoverflow.com/questions/42056936
复制相似问题