$('#h5).find('.page').eq(index).trigger('onLoad')能否换成$(this).trigger('onLoad')?

来源:

杨洋1989

2016-06-09

测试后效果相同。既然fullpage的初始化函数已经限定了id是h5页面,为何还要在内部做精确化选择?

写回答

1回答

Lyn

2016-06-13

可以的,这个只是因为课程的演示代码,所以这么写,这个代码没有实际意义。

实际上后面 fullPage 初始化,触发 onLoad 的代码会变成:


this.el.fullpage({
            onLeave:function( index, nextIndex, direction) {
                $(this).find('.h5_component').trigger('onLeave');
            },
            afterLoad:function( anchorLink, index ) {
                $(this).find('.h5_component').trigger('onLoad');
            }
        });


0
1
杨洋1989
非常感谢!
2016-06-13
共1条回复

Web App用组件方式开发全站

用HTML5/CSS3/JS流行技术,实现移动端可视化数据报告

3164 学习 · 516 问题

查看课程