javascript - FullscreenBookBlock - 在页面上时的活动类
问题描述
所以我们在这里使用了一个很好的图书馆翻书 - https://tympanus.net/codrops/2012/12/11/fullscreen-pageflip-layout/。您会注意到每个活动页面(bb-item 类),display:block 的样式;被添加。
我在这里要做的只是在该页面处于活动状态时添加一个类。所以例如当页面是 display:block; 它将添加一个 .active 类
我已经浏览了所有文档,但找不到任何帮助,有人可以帮忙吗?
下面是基本标记,但我添加的任何内容都不起作用。
var $container = $( '#container' ),
// the element we will apply the BookBlock plugin to
$bookBlock = $( '#bb-bookblock' ),
// the BookBlock items (bb-item)
$items = $bookBlock.children(),
// index of the current item
current = 0,
// initialize the BookBlock
bb = $( '#bb-bookblock' ).bookblock( {
speed : 800,
perspective : 2000,
shadowSides : 0.8,
shadowFlip : 0.4,
// after each flip...
onEndFlip : function(old, page, isLimit) {
// update the current value
current = page;
// update the selected item of the table of contents (TOC)
updateTOC();
// show and/or hide the navigation arrows
updateNavigation( isLimit );
// initialize the jScrollPane on the content div for the new item
setJSP( 'init' );
// destroy jScrollPane on the content div for the old item
setJSP( 'destroy', old );
}
} ),
// the navigation arrows
$navNext = $( '#bb-nav-next' ),
$navPrev = $( '#bb-nav-prev' ).hide(),
// the table of content items
$menuItems = $container.find( 'ul.menu-toc > li' ),
// button to open the TOC
$tblcontents = $( '#tblcontents' ),
transEndEventNames = {
'WebkitTransition': 'webkitTransitionEnd',
'MozTransition': 'transitionend',
'OTransition': 'oTransitionEnd',
'msTransition': 'MSTransitionEnd',
'transition': 'transitionend'
},
// transition event name
transEndEventName = transEndEventNames[Modernizr.prefixed('transition')],
// check if transitions are supported
supportTransitions = Modernizr.csstransitions;
我们可以将事件添加到以下内容中:-
function init() {
// initialize jScrollPane on the content div of the first item
setJSP( 'init' );
initEvents();
}
解决方案
推荐阅读
- java - DynamoDb:使用 findAllById(ids) 访问数据是一个例外
- mysql - 将数据从 Perl 插入到 MySQL
- python - 如何更改文件夹中的所有文件名?
- javascript - 在 ChartJS 时间序列中显示没有数据的时间戳之间的差距
- flutter - Flutter Colors 我想获取颜色的字符串值
- python-3.x - 为什么 python 脚本无法在 AWS ec2 中运行?
- sql - SQL 查询:EXTRACT(DATE FROM timestamp) 与 WHERE 时间戳之间的区别
- image - Scrapy:检查响应是否为图像
- lotus-notes - 代理选项中“使用”的作用是什么,如何使用?
- flutter - 没有为 BottomAppBar() 小部件定义名称参数 'Child'