Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anchors do not work with jquery 3.x #178

Open
FionNoir opened this issue Apr 16, 2019 · 8 comments
Open

Anchors do not work with jquery 3.x #178

FionNoir opened this issue Apr 16, 2019 · 8 comments

Comments

@FionNoir
Copy link

By using jquery 3.3.1 the anchor passed by the URL isn't working. So the page always start with the frist view (langing page). It works fine with jquery 1.x.
I want to use a newer jquery version cause of other frameworks in my project.

@alvarotrigo
Copy link
Owner

Can you please provide an isolated reproduction of the issue?

@cnakh
Copy link

cnakh commented Jun 3, 2019

I use jQuery 3.4.1 got the problem with anchor.
After changed to <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>, it works normally.

@alvarotrigo
Copy link
Owner

alvarotrigo commented Jun 3, 2019

I'll wait for an isolated reproduction of the issue in jsfiddle or codepen.

@shurshilov
Copy link

what waiting your lib don work with jquery 3.3.1

@alvarotrigo
Copy link
Owner

Can you provide an isolated reproduction of it?
I would however recommend you to move to fullPage.js. It's the all-powerful big brother :)

@shurshilov
Copy link

               Ijust now added after render click handler and it work, but if we use custom menu on scroll it change but on click in Jquery 3.3.1 it doesnt work
                $('#full-page').pagepiling({
                    navigation: false,
                    verticalCentered: false,
                    anchors: ['section1', 'section2', 'section3', 'section4'],
                    menu: '.nav_index-page',
                    afterRender: function(){
                        $('[data-menuanchor="section1"]').on('click', (e)=>{
                            $.fn.pagepiling.moveTo(1);
                            $('[data-menuanchor*="section"]').removeClass('active')
                            $(e.currentTarget).addClass('active')
                        })
                        $('[data-menuanchor="section2"]').on('click', (e)=>{
                            $.fn.pagepiling.moveTo(2);
                            $('[data-menuanchor*="section"]').removeClass('active')
                            $(e.currentTarget).addClass('active')
                        })
                        $('[data-menuanchor="section3"]').on('click', (e)=>{
                            $.fn.pagepiling.moveTo(3);
                            $('[data-menuanchor*="section"]').removeClass('active')
                            $(e.currentTarget).addClass('active')
                        })
                        $('[data-menuanchor="section4"]').on('click', (e)=>{
                            $.fn.pagepiling.moveTo(4);
                            $('[data-menuanchor*="section"]').removeClass('active')
                            $(e.currentTarget).addClass('active')
                        })
                    },
                    afterLoad: function (anchorLink, index) {
                        if (index === 1) {
                            $section__text_block.addClass('animate');
                        } else if (index === 3) {
                            $custom_wrap.addClass('body_bg_white');
                            $section3_header.addClass('animate');
                            $section3_subheader.addClass('animate');
                            // $('.slider').slick('slickGoTo', 0);
                        } else if (index === 2) {
                            $section2_header.addClass('animate');
                            $section__block.each(function (index) {
                                $(this).css('transition-delay', (index * 200) + 'ms');
                            });
                            $section__block.addClass('animate');
                        } else if (index === 4) {
                            $custom_wrap.addClass('body_bg_blue');
                            $section__address.each(function (index) {
                                $(this).addClass('animate');
                            });
                        }
                    },
                    onLeave: function (index, nextIndex, direction) {
                        $custom_wrap.removeClass('body_bg_white body_bg_blue');
                        $section__text_block.removeClass('animate');
                        $section2_header.removeClass('animate');
                        $section3_header.removeClass('animate');
                        $section3_subheader.removeClass('animate');
                        $('#section2 .section__block').removeClass('animate');
                        $section__address.each(function (index) {
                            $(this).removeClass('animate');
                        });
                    }
                });

@alvarotrigo
Copy link
Owner

Link to jsfiddle or codepen please?

@alvarotrigo
Copy link
Owner

Also, remove all the content in every callback. Just need an isolated reproduction. Replace those for console.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants