jquery - Change default scrollbar scrollposition in an html div -


is possible change starting scrollposition of 'scrollbar' css or jquery

see demo - div.container scroll until active element item(blue color) shown topmost element in div.

note : dont need jquery 'content scroll' plugin

<div class="container">     <ul class="content">         <li>1</li>         <li>2</li>         <li>3</li>         <li>4</li>         <li class="active">5 active</li>         <li>6</li>         <li>7</li>         <li>8</li>         <li>9</li>         <li>10</li>     </ul> </div> 

apply scrolltop() way:

$('.container').scrolltop($('.content').find('.active').position().top); 

demo


if want animated way use .scrolltop() .animate():

$('.container').animate({     scrolltop:$('.content').find('.active').position().top }); 

demo animate.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -