AlreadyM / jscrollpane

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

Scroll event should provide some useful data (patch included) #210

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The scroll event alone is not that useful, when I wanted to use it, I needed 
the position and the current size of the content.

Basically all I did is replace the simple trigger line with this:

$this.trigger('scroll',[p,$this.outerHeight()]);

I used this to maintain the scroll position when I added new data to the 
beginning of the content.

I may have missed other useful data... for my use case these two were enough.

Original issue reported on code.google.com by djdarkm...@gmail.com on 1 Aug 2010 at 3:44

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the patch - it makes sense to include more information in the scroll 
event. I'm currently working on a rewrite of jScrollPane so I'll bear this in 
mind in the rewrite...

Original comment by kelvin.l...@gmail.com on 2 Aug 2010 at 12:18

GoogleCodeExporter commented 9 years ago
In fact, I just remembered that the position is available via the .data 
property already... e.g.

$('scroll-pane').data('jScrollPanePosition');

Not sure if that would have helped in your situation?

Original comment by kelvin.l...@gmail.com on 2 Aug 2010 at 8:47

GoogleCodeExporter commented 9 years ago
When I use events I normally expect to get the state of the event, basically a 
scroll event is a 'scroller change' event, so in my opinion it makes sense to 
get the new scroller position, because if I capture this event I am probably 
interested in this. By the way I did a runtime patch for myself, I added a few 
more methods, and started to work on making chaining work with jScrollPane, I 
will attach it just in case you are interested in it.

Original comment by djdarkm...@gmail.com on 2 Aug 2010 at 9:12

Attachments:

GoogleCodeExporter commented 9 years ago
I agree that it makes sense to have the information in there... I was just 
answering a question someone else asked and realised that there was a way to 
get at the information (even if it's not ideal).

Thanks for the patch. As mentioned before, I'm in the middle of a rewrite of 
jScrollPane (the current code base is 3.5 years old and is showing it's age!). 
I will be done with it at some point this week and you'll probably find it a 
lot more useful/ extendable than the current version.

If you have any other feedback for stuff you'd have liked to be included then 
this is a great time to let me know.

Original comment by kelvin.l...@gmail.com on 2 Aug 2010 at 9:22

GoogleCodeExporter commented 9 years ago
Well it would be cool to have chainable method like this:

$("#foo").jScrollPane({/.options.../}).jScrollPane('toBottom');
if ($("#foo").jScrollPane('hasScrollbar')) {
//
}

Basically the functionalities I needed is:
position in scroll event
get content height
get scrollpane height
has scrollbar?
scrollTo
toBottom

Original comment by djdarkm...@gmail.com on 3 Aug 2010 at 7:02

GoogleCodeExporter commented 9 years ago
On the rewrite I'm thinking something more like this:

var jspApi = $('#foo').jScrollPane(/.options.../).data('jsp');
alert(jsApi.contentHeight);
jspApi.scrollToBottom();

etc etc... Would this work for you? 

Original comment by kelvin.l...@gmail.com on 3 Aug 2010 at 9:42

GoogleCodeExporter commented 9 years ago
As long as it provides the functions I need and has a minimal API doc: yes.

Original comment by djdarkm...@gmail.com on 3 Aug 2010 at 11:33

GoogleCodeExporter commented 9 years ago
I have just announced the beta of a completely rewritten version of jScrollPane:

http://groups.google.com/group/jscrollpane/browse_thread/thread/c1bc1bf63e3f80d8

Please test and reply on the list if you are still having this issue,

Thanks,

Kelvin

[note that the events aren't implemented yet but they are on my list to be done 
very soon, everything else is implemented]

Original comment by kelvin.l...@gmail.com on 17 Aug 2010 at 4:22