Okay
  Public Ticket #3736070
Onclick scroll to div attribute not working
Closed

Comments

  • Manish started the conversation

    Onclick on any button or link not scrolling to any elementor container attribute.For example in HMTL but i am using in elementor not working.

    <a href="#down-below">Click</a>

    <div id="down-below">dummy text here<div>


    You can check here

    https://xyy.cra.mybluehost.me/meahcomeacomms/meem/wp-admin
    Username: dev
    Password: 65Q0@#aFVgJNLVu!x#bSWd7d

  •  1,972
    Support replied

    Hello,

    first of all we have commented this bit in /js/core/common.js, function FirstLoad()

    $(window).on('popstate', function() {
         location.reload(true);
    });

    Second, we added smoothness to the scroll to anchor you can add the following in the parent theme's /js/scripts.js, CustomFunction

    $( "a[href*='#']" ).on('click', function( e ){

          if(window.location.hash) {

                e.preventDefault();

                var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
                let id = document.getElementById(hash);
                id.scrollIntoView({ behavior: "smooth", block: "start", inline: "nearest" });
                // hash found
          }
    });

    and you can also change the parameters for function scrollIntoView

    https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView

    Hard refresh the page (Ctrl+F5) before testing

    https://xyy.cra.mybluehost.me/meahcomeacomms/meem/about-test/

    https://prnt.sc/wd60OK149Apx

    Thank you.

    Clapat Support

    https://www.clapat.com/

    Review Envato Item Support Policy