问题描述
我正在使用翻转图书插件,,其中一项功能是
I'm using a flip book plugin, Jquery Booklet and one of the functions is to go to a specific page in the Flipbook.
.booklet("gotopage", index)
我正在做一个模态,包含一个小的缩略图布局,我想要的能力点击缩略图,关闭模态和小册子页面打开图像所在的特定页面。我试着下面的代码,第一次工作,但不是后续的时间。任何帮助将不胜感激。
I am making a modal that contains a small thumbnail layout where I want the ability to click on a thumbnail, close the modal and the Booklet page will open to the specific page the image is on. I am trying the following code which works the first time but not subsequent times. Any help would be appreciated!
$('.item a .counter').click(function(e){
e.preventDefault();
var gotoimage = $(this).text();
$('#mybook').booklet("gotopage", gotoimage);
$('#thumbs').modal('hide');
});
推荐答案
我对原始代码感到失望后,使用此代码执行此操作:
After some frustration with my original code I figured out how to do this using this code:
$(".item a").click(function () {
var index = $(".item a").index(this) + 2;
$('#mybook').booklet("gotopage", index);
$('#thumbs').modal('hide');
return false;
});
由于我的Thumb图库和小册子幻灯片有相同的索引#的图像,我只需要添加+ 2,因为我意识到小册子有一个封面和封底,所以我需要让索引开始2数字,而不是0基于。
Since my Thumb gallery and the Booklet Flipbook have the same index # of images, it worked. I just needed to add the + 2 because I realized the Booklet has a front and back cover so I needed to have the index start 2 numbers up, rather than 0 based.
这篇关于Jquery点击功能只会触发一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!