data-href scroll problem error

2 replies·opened Dec 17, 2018
D
Deluxe23Dec 17, 2018

i try the code from http://support.semicolonweb.com/forums/topic/data-href-scroll-problem/.
i put it after the functions.js include:

...
	<!-- Footer Scripts
	============================================= -->
	<script src="js/functions.js"></script>
<script>
    jQuery(document).ready( function(){
        setTimeout(function() {
            if (location.hash) {
                window.scrollTo(0, 0);
            }
        }, 1);
    });
 
    jQuery(window).on('load', function(){
        var divScrollToAnchor = window.location.hash;
 
        if( typeof divScrollToAnchor !== 'undefined' ) {
            var t = setTimeout( function(){
                $('html,body').stop(true).animate({
                    'scrollTop': $( divScrollToAnchor ).offset().top - 100
                }, 700, 'easeOutQuad');
            }, 1000);
        }
    });
</script>
</body>
</html>

but i get JS error in browser-console: TypeError: $(...).offset(...) is undefined

D
Deluxe23Dec 17, 2018

console says error is on that line: 'scrollTop': $( divScrollToAnchor ).offset().top - 100

by the way: i can't edit my post, this error message appear : You do not have a License for data-href scroll problem error to Create a New Topic. Please Purchase or Renew License.

S
SemiColonWebSTAFFDec 19, 2018

Hello,

Please provide us with a Live URL so that we can check out the exact issue and provide you with a more accurate solution for this. Thanks for your Patience.

Meanwhile, do let us know if we can help you with anything else or if you find any further issues with Canvas.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard