summaryrefslogtreecommitdiff
path: root/static/scroll.js
diff options
context:
space:
mode:
authorScott Ostler <sostler@ubuntu.(none)>2010-01-03 00:57:07 -0500
committerScott Ostler <sostler@ubuntu.(none)>2010-01-03 00:57:07 -0500
commit9d7877bb39a0ff45ce67e95ca04d32077027a23a (patch)
treeb4890a035885e312c1fd066cbb91d366dcf2e0c4 /static/scroll.js
parenta80eb3d74a24a56151d60d1c1015a1ae51a0a492 (diff)
Adding latest content
Diffstat (limited to 'static/scroll.js')
-rw-r--r--static/scroll.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/static/scroll.js b/static/scroll.js
new file mode 100644
index 0000000..955e188
--- /dev/null
+++ b/static/scroll.js
@@ -0,0 +1,49 @@
+// JavaScript Document
+var scrollbar = new Control.ScrollBar('scrollbar_content','messagePane');
+
+$('scroll_down_50').observe('click',function(event){
+ scrollbar.scrollBy(-50);
+ event.stop();
+});
+
+$('scroll_up_50').observe('click',function(event){
+ scrollbar.scrollBy(50);
+ event.stop();
+});
+
+$('scroll_top').observe('click',function(event){
+ scrollbar.scrollTo('top');
+ event.stop();
+});
+
+$('scroll_bottom').observe('click',function(event){
+ //to animate a scroll operation you can pass true
+ //or a callback that will be called when scrolling is complete
+ scrollbar.scrollTo('bottom',function(){
+ if(typeof(console) != "undefined")
+ console.log('Finished scrolling to bottom.');
+ });
+ event.stop();
+});
+
+$('scroll_second').observe('click',function(event){
+ //you can pass a number or element to scroll to
+ //if you pass an element, it will be centered, unless it is
+ //near the bottom of the container
+ scrollbar.scrollTo($('second_subhead'));
+ event.stop();
+});
+
+$('scroll_third').observe('click',function(event){
+ //passing true will animate the scroll
+ scrollbar.scrollTo($('third_subhead'),true);
+ event.stop();
+});
+
+$('scroll_insert').observe('click',function(event){
+ $('scrollbar_content').insert('<p><b>Inserted: ' + $('repeat').innerHTML + '</b></p>');
+ //you only need to call this if ajax or dom operations modify the layout
+ //this is automatically called when the window resizes
+ scrollbar.recalculateLayout();
+ event.stop();
+}); \ No newline at end of file