[Resolved] Anchors in responsive site dont work

Home Forums Support [Resolved] Anchors in responsive site dont work

Home Forums Support Anchors in responsive site dont work

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #361804
    mike

    hi there!

    i have added anchors in the nav bar, they work fine on desktop, but not on mobile..

    any ideas?

    thanks

    #361844
    Leo
    Staff
    Customer Support

    Hi there,

    Hmm anchors should work exactly same on desktop and mobile.

    Can you link me to the page that’s not working? Thanks!

    #361860
    mike

    sure

    b3u5e.hosts.cx/ – temporary link

    i have added anchors in buttons in the site and the same thing – they work only on desktop

    id without #
    links #example

    #361974
    mike

    help?

    #361976
    Tom
    Lead Developer
    Lead Developer

    Can you try adding the full URL along with the anchor as the URL?

    #362085
    mike

    tried it. still only works on desktop

    it’s the third item in the menu

    #362268
    Tom
    Lead Developer
    Lead Developer

    What script are you using for the smooth scroll? If you turn it off, does the link jump to the correct area?

    #362300
    mike

    this is it –

    the link jumps to the correct area with or without the script

    thanks
    <script>
    jQuery( document ).ready( function( $ ) {
    $( document ).on( ‘click’, ‘.main-nav li > a:first-child’, function( e ) {
    var mobile = $( ‘.menu-toggle’ );
    if ( mobile.is( ‘:visible’ ) ) {
    $( ‘.menu-toggle’).closest( ‘.main-navigation’ ).removeClass( ‘toggled’ );
    $( ‘.menu-toggle’).closest( ‘.main-navigation’ ).attr( ‘aria-expanded’, $( ‘.menu-toggle’).closest( ‘.main-navigation’ ).attr( ‘aria-expanded’ ) === ‘true’ ? ‘false’ : ‘true’ );
    $( ‘.menu-toggle’).removeClass( ‘toggled’ );
    $( ‘.menu-toggle’).children( ‘i’ ).addClass( ‘fa-bars’ ).removeClass( ‘fa-close’ );
    $( ‘.menu-toggle’).attr( ‘aria-expanded’, $( this ).attr( ‘aria-expanded’ ) === ‘false’ ? ‘true’ : ‘false’ );
    }
    });
    });
    </script>

    #362582
    mike

    would love an answer ๐Ÿ˜‰ boss is sitting on my head :/

    thank you and have a great evening!

    #362810
    Tom
    Lead Developer
    Lead Developer

    Have you considered just using a plugin like this?: https://en-ca.wordpress.org/plugins/easy-smooth-scroll-links/

    #363038
    mike

    hi tom

    i dont have a problem with the scroll i think you got my post confused with someone elses.

    my anchor links don’t function on mobile is my issue

    thank you

    #363137
    Leo
    Staff
    Customer Support
    #363194
    Tom
    Lead Developer
    Lead Developer

    Ah, I assumed that code was for smooth scrolling.

    Can you remove that code completely? It’s not necessary.

    #363448
    mike

    i have removed it

    the anchor links still don’t function on mobile

    #363565
    mike

    please help i need my anchors ๐Ÿ™‚

Viewing 15 posts - 1 through 15 (of 18 total)
  • You must be logged in to reply to this topic.