JQuery matchHeight maintainScroll not working

I have used jQuery matchHeight on multiple elements in my site. I can initiate an update if needed by firing:

$.fn.matchHeight._update();

      

My problem is I am losing the scroll position. There is $.fn.matchHeight._maintainScroll = true;

one that I set at the top of the function where I call matchHeight into the game. And connected to my Slider onChange function, I have an update like:

$('#reviews-slider').owlCarousel({
        loop: true,
        margin: 0,
        nav: false,
        lazyLoad : true,
        items: 1,
        dots: true,
        autoHeight:true,
        itemElement: 'blockquote',
        dotsSpeed: 400,
        autoplay: false,
        onChanged : function () {
            $.fn.matchHeight._update();
        }
    });

      

Does anyone know what I am doing wrong and why my maintainer rollout is not working. Can it be called together with _update

? I tried to put it in a change function, however it still didn't work.

The reason I want to use the scrolling support is because when I run the update, the content can be significantly longer and cause a jump in the page position. There is a note for this at the bottom of the git page, however I cannot get it to work.

+3


source to share


1 answer


With the same problem after the ajax call my page jumped up. Option _maintainScrollPosition

seems to count, but $(window).scrollTop()

always 0 in webkit browsers due to an error or "error flag".

Library code that is causing this problem:

// take note of scroll position
var scrollTop = $(window).scrollTop(), // seems to be 0 most of the time 

// ***

// restore scroll position if enabled
if (matchHeight._maintainScroll) {
    $(window).scrollTop((scrollTop / htmlHeight) * $('html').outerHeight(true));
}

      



We all know what multiplication by 0 looks like.

Decision

Unfortunately, this is a radical CSS change in which you remove the height: 100%

html and body from the tag. Also, overflow: hidden

the case will work if you are dealing with overflow containers, for example.

0


source







All Articles