Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page jumps up on reloading the elements when using ajax pagination #18

Closed
nulian opened this issue Jul 22, 2014 · 5 comments
Closed

Page jumps up on reloading the elements when using ajax pagination #18

nulian opened this issue Jul 22, 2014 · 5 comments

Comments

@nulian
Copy link

nulian commented Jul 22, 2014

The page jumps up on reloading the elements when using ajax pagination.
I fixed it by saving the scroll position and reloading it on this part of the code.
Thought it might be usefull.


if (byRow) {
      var scroll = $(window).scrollTop();
      // must first force an arbitrary equal height so floating elements break evenly
      $elements.css({
        'display': 'block',
        'padding-top': '0',
        'padding-bottom': '0',
        'border-top-width': '0',
        'border-bottom-width': '0',
        'height': '100px'
      });

      // get the array of rows (based on element top position)
      rows = _rows($elements);

      // revert the temporary forced style
      $elements.css({
        'display': '',
        'padding-top': '',
        'padding-bottom': '',
        'border-top-width': '',
        'border-bottom-width': '',
        'height': ''
      });
      $(window).scrollTop(scroll);
    }
@liabru
Copy link
Owner

liabru commented Jul 27, 2014

Can you provide your original code to demonstrate the issue please?

@liabru
Copy link
Owner

liabru commented Aug 10, 2014

Without your original code I'm finding it hard to think about why this might be caused by matchHeight.
Closing for now unless you can help with an explanation?

@liabru liabru closed this as completed Aug 10, 2014
@liabru liabru reopened this Aug 13, 2014
@liabru liabru closed this as completed in ee83317 Aug 18, 2014
@liabru
Copy link
Owner

liabru commented Aug 18, 2014

I have added a new feature for this case, it isn't enabled by default, so you must enable it like so:

$.fn.matchHeight._maintainScroll = true;

@fro
Copy link

fro commented Apr 28, 2016

@liabru $.fn.matchHeight._maintainScroll = true; is a brilliant feature, thank you. :-)

@ksaifullah
Copy link

@liabru Thank you very much. It saved my hours of work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants