jeffreyhi1 / jscrollpane

Automatically exported from code.google.com/p/jscrollpane
0 stars 0 forks source link

scrollTo not working at all. #94

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to use scrollTo
2.
3.

What is the expected output? What do you see instead?
Expected output is for the scrollPane to scroll. I get the following error
instead:
Error: $("#scrollwrap_" + objectName).scrollTo is not a function

What version of the jScrollPane are you using? On what browser? And
operating system?
Latest version of jScrollPane. Firefox 3, IE8. XP

Please provide a URL to a page displaying the problem.

Please provide any additional information below.

Original issue reported on code.google.com by lylepr...@gmail.com on 15 Apr 2009 at 4:03

GoogleCodeExporter commented 9 years ago
Here is the code I am using:
$('#scrollwrap_'+objectName).scrollTo(600);

Original comment by lylepr...@gmail.com on 15 Apr 2009 at 4:12

GoogleCodeExporter commented 9 years ago
scrollTo is a method on the DOM element itself, not on the jQuery object. See 
this
demo for usage:

http://www.kelvinluck.com/assets/jquery/jScrollPane/scrollTo.html

Basically you need to do:

$('#scrollwrap_'+objectName)[0].scrollTo(600);

Hope that helps,

Kelvin :)

Original comment by kelvin.l...@gmail.com on 15 Apr 2009 at 4:19

GoogleCodeExporter commented 9 years ago
Ahh I see. Thanks for your help!

Heres another question:
Could I just manually set the focus on the element (using $.focus()??) I want to
scroll to and wouldnt your plugin automatically scroll there?

Original comment by lylepr...@gmail.com on 15 Apr 2009 at 4:22

GoogleCodeExporter commented 9 years ago
Yes - that could quite possibly work. Only certain elements can be focused 
though (in
a cross browser manner). If the element in question is an link or a form 
element that
should work great... You can also use .scrollTo('JQUERY_SELECTOR') to scroll a
particular element to the top of the visible pane (where JQUERY_SELECTOR is a 
jquery
selector to find the element you want to scroll to)...

Original comment by kelvin.l...@gmail.com on 24 Apr 2009 at 6:00