Skip to content

pjax scrolls to top by default #133

Closed
staabm opened this Issue Apr 29, 2012 · 12 comments

8 participants

@staabm
staabm commented Apr 29, 2012

is it intended behaviour, that on each pjax request the browser scrolls to top?

the reason for this is that scrollTo defaults to 0 instead of false


pjax.defaults = {
  timeout: 650,
  push: true,
  replace: false,
  type: 'GET',
  dataType: 'html',
  scrollTo: 0,
  maxCacheLength: 20
}

@staabm staabm referenced this issue in redaxo/redaxo Apr 29, 2012
Closed

pjax: timeout message #60

@josh
Collaborator
josh commented Apr 29, 2012

Yes, set $.pjax.defaults = false to turn it off.

@josh josh closed this Apr 29, 2012
@jsierles

This should read:

$.pjax.defaults.scrollTo = false;
@smith
smith commented Aug 22, 2012

Not sure if it's a bug, but for me, $.pjax.defaults is undefined in IE (<= 9). Was able to work around with $.pjax.defaults = $.pjax.defaults || {}; $.pjax.defaults.scrollTo = false;. Should an issue be opened for this?

@josh
Collaborator
josh commented Aug 22, 2012

pjax requires >= IE 10

@smith
smith commented Aug 22, 2012

Understood. Is it expected to fail gracefully in earlier versions?

@josh
Collaborator
josh commented Aug 22, 2012

You can use the $.support.pjax to condition your custom pjax code to not run on oldIE

@starzonmyarmz

Just because it requires a certain browser... I think it should at least fail gracefully

@smith
smith commented Aug 22, 2012

@josh Thanks that helps. @starzonmyarmz It does fail gracefully, but if you try to set $.pjax.defaults values, you'll want to wrap it in an if ($.support.pjax).

@starzonmyarmz

gotcha - thanks for clarifying

@RohitRox
RohitRox commented Jan 7, 2013

thanks for
$.pjax.defaults.scrollTo = false

@rjquery
rjquery commented Feb 4, 2013

thanks for $.pjax.defaults.scrollTo = false;!!!! [2]

@almirb
almirb commented Jun 8, 2016

Hello!

Why the scrollTo defaults are different in Yii Pjax widget and jquery.pjax.js?

http://www.yiiframework.com/forum/index.php/topic/71190-difference-between-pjax-defaults-php-widget-and-jquery/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.