html

当前位置:首页 > 前端 > html

fullpage 回调函数

<script type="text/javascript"> $(function () { var _h = $("#menu").height(); var _s = $("#menu li").size() - ...
<script type="text/javascript">
    $(function () {
        var _h = $("#menu").height();
        var _s = $("#menu li").size() - 1;
        $('#fullpage').fullpage({
            anchors: ['page1', 'page2', 'page3', 'page4', 'page5', 'page6'],
            menu: '#menu',
            verticalCentered: true,
            afterLoad: function (anchorLink, index) {

                if (index == 2) {
                    $('.section2').find('.wordc').addClass("active");
                    $(document).ready(function () {
                        $('.counter-value').each(function () {
                            $(this).prop('Counter', 0).animate({
                                Counter: $(this).text()
                            }, {
                                duration: 3500,
                                easing: 'swing',
                                step: function (now) {
                                    $(this).text(Math.ceil(now));
                                }
                            });
                        });
                    });

                }

                if (index == 3) {
                    $('.section3').find('.wordc').addClass("active");
                    $('.section3').find('.imgc').addClass("active");

                }

                if (index == 4) {
                    $('.section4').find('.wordc').addClass("active");
                    $('.section4').find('.pinguang').addClass("active");
                }

                if (index == 5) {
                    $('.section5').find('.wordc').addClass("active");

                }

                if (index == 6) {
                    $('.section6').find('.wordc').addClass("active");
                    $('.section6').find('.link').addClass("active");
                    $('.section6').find('.footer').addClass("active");
                }

            },

            onLeave: function (index, direction) {

                if (index == '2') {

                    $('.section2').find('.wordc').removeClass("active");
                    $('.section2').find('.mun li span').removeClass("counter-value");

                }

                if (index == '3') {
                    $('.section3').find('.wordc').removeClass("active");
                    $('.section3').find('.imgc').removeClass("active");

                }

                if (index == '4') {
                    $('.section4').find('.wordc').removeClass("active");
                    $('.section4').find('.pinguang').removeClass("active");

                }

                if (index == '5') {
                    $('.section5').find('.wordc').removeClass("active");

                }
                if (index == '6') {
                    $('.section6').find('.wordc').removeClass("active");
                    $('.section6').find('.link').removeClass("active");
                    $('.section6').find('.footer').removeClass("active");

                }

            }

        });
    })
</script>


相关内容

文章评论

表情

共 0 条评论,查看全部
  • 这篇文章还没有收到评论,赶紧来抢沙发吧~