0

I have a page with some sections. Any section have some OwlCarouse.When menu items anchor to sections (http://site/index.html#section), page scrolled to first of section position but when I copy link into another tab, position changed.

I think the problem is related to OwlCarousel jQuery loading. How to load it after page loading?

Javad
  • 178
  • 2
  • 14

2 Answers2

1
    if ( window.location.hash ) scroll(0,0);
    setTimeout( function() { scroll(0,0); }, 1);

    $(function() {

        if(window.location.hash) {
            $('html, body').animate({
                scrollTop: $(window.location.hash).offset().top + 'px'
            }, 1000, 'swing');
        }
    });
Javad
  • 178
  • 2
  • 14
0

Try initializing owl carousel after window is loaded:

$("window").load(function(){
  // initialize owl carousel
})
Developer107
  • 1,728
  • 2
  • 14
  • 24