javascript - jQuery.kinetic - How to pre-scroll to a position when page loads -


i'm using jquery.kinetic allow div scrolled within parent div dragging mouse, demo on author's site. default, when page loads, upper left corner of inner div aligned upper left corner of parent div (meaning it's scrolled far , left possible). this:

default

i "pre-scroll" when page loads specific number of pixels on inner div centered. this:

new

i'm not seeing in documentation being able specify starting position inner div looks author of jquery.kinetic built in way extend plugin beyond default functionality this:

$.kinetic.prototype.newfeature = function(options){    // define task }; 

then can call functionality:

// use method $('#elem').kinetic('newfeature', { options }); 

is there way set position on page load i'm missing? if not, how can extend plugin want?

thanks!

it took me forever figure out kinetic plugin has built-in abilities manually scroll container. it's not anywhere in documentation, through inspecting plugin code noticed has methods control x , y-axis scroll position.

in file jquery.kinetic.js line 458 475 (at time of writing) scrollleft , scrolltop methods defined. https://github.com/davetayls/jquery.kinetic/blob/master/jquery.kinetic.js#l458

you can use them on container active instance of kinetic calling following methods:

$("container-selector").kinetic("scrollleft", 50); $("container-selector").kinetic("scrolltop", 480); 

it's worthwhile go through kinetic code , figure out how works , functionalities available use en lieu of more fleshed-out documentation.


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -