From 183f8aa006227ed95faa484763d5ca29e27e7c58 Mon Sep 17 00:00:00 2001 From: "@rochal" Date: Mon, 11 Mar 2013 10:43:59 +1100 Subject: [PATCH 01/67] Add `railDraggable` option allowing to disable scrollbar drag. This is handy when you only rely on mousewheel scroll and you don't want to add jQuery UI as dependency. --- examples/rail.html | 28 ++++++++++++++++++++++++++++ jquery.slimscroll.js | 31 ++++++++++++++++++------------- 2 files changed, 46 insertions(+), 13 deletions(-) diff --git a/examples/rail.html b/examples/rail.html index 72b4551..2bd6236 100644 --- a/examples/rail.html +++ b/examples/rail.html @@ -131,6 +131,30 @@

Facebook-style jQuery Scrollbar

}); +
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus, felis interdum condimentum consectetur, nisl libero elementum eros, vehicula congue lacus eros non diam. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus mauris lorem, lacinia id tempus non, imperdiet et leo. Cras sit amet erat sit amet lacus egestas placerat. Aenean ultricies ultrices mauris ac congue. In vel tortor vel velit tristique tempus ac id nisi. Proin quis lorem velit. Nunc dui dui, blandit a ullamcorper vitae, congue fringilla lectus. Aliquam ultricies malesuada feugiat. Vestibulum placerat turpis et eros lobortis vel semper sapien pulvinar.

+

Pellentesque rhoncus aliquet porta. Sed vel magna eu turpis pharetra consequat ut vitae lectus. In molestie sollicitudin mi sit amet convallis. Aliquam erat volutpat. Nullam feugiat placerat ipsum eget malesuada. Nulla facilisis nunc non dolor vehicula pretium. Sed dui magna, sodales id pharetra non, ullamcorper eu sapien. Mauris ac consectetur leo. Mauris consequat, lectus ut bibendum pulvinar, leo magna feugiat enim, eu commodo lacus sem vel ante. Sed tempus metus eget leo mollis vulputate. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

+

Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed pulvinar rhoncus quam, vel semper tellus viverra id. Nulla rutrum porttitor odio, a rutrum purus gravida non. Etiam ac purus augue, eget vestibulum purus. Aenean venenatis ullamcorper augue, non consequat elit tempor sed. Donec velit sapien, volutpat sed ultricies egestas, semper a ante. Fusce dapibus, quam eget auctor suscipit, nibh leo posuere ante, at auctor nisi lacus in sem. Morbi interdum consectetur euismod. Cras accumsan est lacus. Nulla eleifend, eros vel consequat commodo, arcu nunc malesuada nunc, quis sagittis felis sem ac turpis.

+

Nulla rhoncus elementum convallis. Mauris condimentum aliquet egestas. Ut iaculis nisi eget tellus accumsan venenatis. Maecenas imperdiet aliquam porta. Aenean ultrices dolor sed quam laoreet varius. Curabitur condimentum blandit erat, quis accumsan eros interdum vitae. Curabitur ligula arcu, sollicitudin vitae iaculis sed, blandit sit amet enim. Morbi ullamcorper, metus vel mollis tristique, arcu turpis malesuada nisi, at dignissim lorem odio a orci. Proin ultrices, ipsum ut vestibulum interdum, libero felis auctor mi, vitae convallis nisl justo ac tellus. Integer nec lacinia turpis. Etiam massa nisl, rhoncus quis rutrum in, pretium eu leo. Proin a velit ut nulla laoreet vestibulum. Curabitur eu elit vitae felis auctor tincidunt. Curabitur tincidunt, metus sed sollicitudin cursus, quam elit commodo erat, ut tempor erat sapien vitae velit. Morbi nec viverra erat.

+

Nullam scelerisque facilisis pretium. Vivamus lectus leo, commodo ac sagittis ac, dictum a mi. Donec quis massa ut libero malesuada commodo in et risus. Fusce nunc dolor, aliquet vel rutrum in, molestie sit amet massa. Aliquam suscipit, justo a commodo condimentum, enim sapien fringilla ante, sed lobortis orci lectus in ante. Donec vel interdum est. Donec placerat cursus lacus, eu ultricies nisl tincidunt a. Fusce libero risus, sagittis eleifend iaculis aliquet, condimentum vitae diam. Suspendisse potenti. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Proin leo purus, sodales a venenatis luctus, faucibus ac enim. Sed id metus ac sem lobortis pretium. Mauris faucibus tempor scelerisque. Nunc vulputate interdum tortor, non tincidunt dui condimentum eget. Aenean in porttitor velit. Nam accumsan rhoncus risus id consectetur.

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus, felis interdum condimentum consectetur, nisl libero elementum eros, vehicula congue lacus eros non diam. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus mauris lorem, lacinia id tempus non, imperdiet et leo. Cras sit amet erat sit amet lacus egestas placerat. Aenean ultricies ultrices mauris ac congue. In vel tortor vel velit tristique tempus ac id nisi. Proin quis lorem velit. Nunc dui dui, blandit a ullamcorper vitae, congue fringilla lectus. Aliquam ultricies malesuada feugiat. Vestibulum placerat turpis et eros lobortis vel semper sapien pulvinar.

+

Pellentesque rhoncus aliquet porta. Sed vel magna eu turpis pharetra consequat ut vitae lectus. In molestie sollicitudin mi sit amet convallis. Aliquam erat volutpat. Nullam feugiat placerat ipsum eget malesuada. Nulla facilisis nunc non dolor vehicula pretium. Sed dui magna, sodales id pharetra non, ullamcorper eu sapien. Mauris ac consectetur leo. Mauris consequat, lectus ut bibendum pulvinar, leo magna feugiat enim, eu commodo lacus sem vel ante. Sed tempus metus eget leo mollis vulputate. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

+

Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed pulvinar rhoncus quam, vel semper tellus viverra id. Nulla rutrum porttitor odio, a rutrum purus gravida non. Etiam ac purus augue, eget vestibulum purus. Aenean venenatis ullamcorper augue, non consequat elit tempor sed. Donec velit sapien, volutpat sed ultricies egestas, semper a ante. Fusce dapibus, quam eget auctor suscipit, nibh leo posuere ante, at auctor nisi lacus in sem. Morbi interdum consectetur euismod. Cras accumsan est lacus. Nulla eleifend, eros vel consequat commodo, arcu nunc malesuada nunc, quis sagittis felis sem ac turpis.

+

Nulla rhoncus elementum convallis. Mauris condimentum aliquet egestas. Ut iaculis nisi eget tellus accumsan venenatis. Maecenas imperdiet aliquam porta. Aenean ultrices dolor sed quam laoreet varius. Curabitur condimentum blandit erat, quis accumsan eros interdum vitae. Curabitur ligula arcu, sollicitudin vitae iaculis sed, blandit sit amet enim. Morbi ullamcorper, metus vel mollis tristique, arcu turpis malesuada nisi, at dignissim lorem odio a orci. Proin ultrices, ipsum ut vestibulum interdum, libero felis auctor mi, vitae convallis nisl justo ac tellus. Integer nec lacinia turpis. Etiam massa nisl, rhoncus quis rutrum in, pretium eu leo. Proin a velit ut nulla laoreet vestibulum. Curabitur eu elit vitae felis auctor tincidunt. Curabitur tincidunt, metus sed sollicitudin cursus, quam elit commodo erat, ut tempor erat sapien vitae velit. Morbi nec viverra erat.

+

Nullam scelerisque facilisis pretium. Vivamus lectus leo, commodo ac sagittis ac, dictum a mi. Donec quis massa ut libero malesuada commodo in et risus. Fusce nunc dolor, aliquet vel rutrum in, molestie sit amet massa. Aliquam suscipit, justo a commodo condimentum, enim sapien fringilla ante, sed lobortis orci lectus in ante. Donec vel interdum est. Donec placerat cursus lacus, eu ultricies nisl tincidunt a. Fusce libero risus, sagittis eleifend iaculis aliquet, condimentum vitae diam. Suspendisse potenti. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Proin leo purus, sodales a venenatis luctus, faucibus ac enim. Sed id metus ac sem lobortis pretium. Mauris faucibus tempor scelerisque. Nunc vulputate interdum tortor, non tincidunt dui condimentum eget. Aenean in porttitor velit. Nam accumsan rhoncus risus id consectetur.

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus, felis interdum condimentum consectetur, nisl libero elementum eros, vehicula congue lacus eros non diam. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus mauris lorem, lacinia id tempus non, imperdiet et leo. Cras sit amet erat sit amet lacus egestas placerat. Aenean ultricies ultrices mauris ac congue. In vel tortor vel velit tristique tempus ac id nisi. Proin quis lorem velit. Nunc dui dui, blandit a ullamcorper vitae, congue fringilla lectus. Aliquam ultricies malesuada feugiat. Vestibulum placerat turpis et eros lobortis vel semper sapien pulvinar.

+

Pellentesque rhoncus aliquet porta. Sed vel magna eu turpis pharetra consequat ut vitae lectus. In molestie sollicitudin mi sit amet convallis. Aliquam erat volutpat. Nullam feugiat placerat ipsum eget malesuada. Nulla facilisis nunc non dolor vehicula pretium. Sed dui magna, sodales id pharetra non, ullamcorper eu sapien. Mauris ac consectetur leo. Mauris consequat, lectus ut bibendum pulvinar, leo magna feugiat enim, eu commodo lacus sem vel ante. Sed tempus metus eget leo mollis vulputate. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

+

Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed pulvinar rhoncus quam, vel semper tellus viverra id. Nulla rutrum porttitor odio, a rutrum purus gravida non. Etiam ac purus augue, eget vestibulum purus. Aenean venenatis ullamcorper augue, non consequat elit tempor sed. Donec velit sapien, volutpat sed ultricies egestas, semper a ante. Fusce dapibus, quam eget auctor suscipit, nibh leo posuere ante, at auctor nisi lacus in sem. Morbi interdum consectetur euismod. Cras accumsan est lacus. Nulla eleifend, eros vel consequat commodo, arcu nunc malesuada nunc, quis sagittis felis sem ac turpis.

+

Nulla rhoncus elementum convallis. Mauris condimentum aliquet egestas. Ut iaculis nisi eget tellus accumsan venenatis. Maecenas imperdiet aliquam porta. Aenean ultrices dolor sed quam laoreet varius. Curabitur condimentum blandit erat, quis accumsan eros interdum vitae. Curabitur ligula arcu, sollicitudin vitae iaculis sed, blandit sit amet enim. Morbi ullamcorper, metus vel mollis tristique, arcu turpis malesuada nisi, at dignissim lorem odio a orci. Proin ultrices, ipsum ut vestibulum interdum, libero felis auctor mi, vitae convallis nisl justo ac tellus. Integer nec lacinia turpis. Etiam massa nisl, rhoncus quis rutrum in, pretium eu leo. Proin a velit ut nulla laoreet vestibulum. Curabitur eu elit vitae felis auctor tincidunt. Curabitur tincidunt, metus sed sollicitudin cursus, quam elit commodo erat, ut tempor erat sapien vitae velit. Morbi nec viverra erat.

+

Nullam scelerisque facilisis pretium. Vivamus lectus leo, commodo ac sagittis ac, dictum a mi. Donec quis massa ut libero malesuada commodo in et risus. Fusce nunc dolor, aliquet vel rutrum in, molestie sit amet massa. Aliquam suscipit, justo a commodo condimentum, enim sapien fringilla ante, sed lobortis orci lectus in ante. Donec vel interdum est. Donec placerat cursus lacus, eu ultricies nisl tincidunt a. Fusce libero risus, sagittis eleifend iaculis aliquet, condimentum vitae diam. Suspendisse potenti. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Proin leo purus, sodales a venenatis luctus, faucibus ac enim. Sed id metus ac sem lobortis pretium. Mauris faucibus tempor scelerisque. Nunc vulputate interdum tortor, non tincidunt dui condimentum eget. Aenean in porttitor velit. Nam accumsan rhoncus risus id consectetur.

+
+ +
+  // This also removes dependency on jQuery UI
+  $('#testDiv5').slimscroll({
+    railDraggable: false
+  });
+
@@ -156,6 +180,10 @@

Facebook-style jQuery Scrollbar

railVisible: true }); + $('#testDiv5').slimscroll({ + railDraggable: false + }); + //enable syntax highlighter prettyPrint(); }); diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index aede60f..eef3b40 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -30,7 +30,9 @@ wrapperClass : 'slimScrollDiv', allowPageScroll : false, scroll : 0, - touchScrollStep : 200 + touchScrollStep : 200, + // whether we should use jQuery UI Draggable to enable bar dragging + railDraggable : true }; var o = $.extend(defaults, options); @@ -109,7 +111,7 @@ }); // create scrollbar rail - var rail = $(divS) + var rail = $(divS) .addClass(o.railClass) .css({ width: o.size, @@ -153,17 +155,20 @@ me.parent().append(rail); // make it draggable - bar.draggable({ - axis: 'y', - containment: 'parent', - start: function() { isDragg = true; }, - stop: function() { isDragg = false; hideBar(); }, - drag: function(e) - { - // scroll content - scrollContent(0, $(this).position().top, false); - } - }); + if (o.useDraggable) + { + bar.draggable({ + axis: 'y', + containment: 'parent', + start: function() { isDragg = true; }, + stop: function() { isDragg = false; hideBar(); }, + drag: function(e) + { + // scroll content + scrollContent(0, $(this).position().top, false); + } + }); + } // on rail over rail.hover(function(){ From 1e99a1604a509bd8e1664dac99402dbe8d044732 Mon Sep 17 00:00:00 2001 From: "@rochal" Date: Mon, 11 Mar 2013 10:45:44 +1100 Subject: [PATCH 02/67] Fix #52. Ensure rail/bar/wrapper classes are not using hard coded names, instead loading them from the options. --- jquery.slimscroll.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index eef3b40..01b21d9 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -50,14 +50,14 @@ var me = $(this); // ensure we are not binding it again - if (me.parent().hasClass('slimScrollDiv')) + if (me.parent().hasClass(o.wrapperClass)) { // start from last bar position var offset = me.scrollTop(); // find bar and rail - bar = me.parent().find('.slimScrollBar'); - rail = me.parent().find('.slimScrollRail'); + bar = me.parent().find('.' + o.barClass); + rail = me.parent().find('.' + o.railClass); getBarHeight(); From d77909bf9c81651476600cbe2f4a261b534789e4 Mon Sep 17 00:00:00 2001 From: "@rochal" Date: Mon, 11 Mar 2013 11:06:13 +1100 Subject: [PATCH 03/67] Update jQuery UI link to use Google CDN on the example pages --- examples/allow-page-scroll.html | 2 +- examples/chaining.html | 2 +- examples/disable-fade-out.html | 2 +- examples/height-width.html | 2 +- examples/mouse-wheel.html | 2 +- examples/multiple-elements.html | 2 +- examples/nested.html | 2 +- examples/programmatic-scrolling.html | 2 +- examples/rail.html | 2 +- examples/scrollbar.html | 2 +- examples/start-position.html | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/allow-page-scroll.html b/examples/allow-page-scroll.html index e8c5da6..d8730ad 100644 --- a/examples/allow-page-scroll.html +++ b/examples/allow-page-scroll.html @@ -4,7 +4,7 @@ jquery.slimscroll - allow page scroll - + diff --git a/examples/chaining.html b/examples/chaining.html index 0fbc6dc..34bf0e1 100644 --- a/examples/chaining.html +++ b/examples/chaining.html @@ -4,7 +4,7 @@ jquery.slimscroll - chaining - + diff --git a/examples/disable-fade-out.html b/examples/disable-fade-out.html index 7a46c1b..2583d09 100644 --- a/examples/disable-fade-out.html +++ b/examples/disable-fade-out.html @@ -4,7 +4,7 @@ jquery.slimscroll - disable fade out - + diff --git a/examples/height-width.html b/examples/height-width.html index fc554e5..7f9db9d 100644 --- a/examples/height-width.html +++ b/examples/height-width.html @@ -4,7 +4,7 @@ jquery.slimscroll - height / width - + diff --git a/examples/mouse-wheel.html b/examples/mouse-wheel.html index eea33de..df88f4d 100644 --- a/examples/mouse-wheel.html +++ b/examples/mouse-wheel.html @@ -4,7 +4,7 @@ jquery.slimscroll - mouse wheel - + diff --git a/examples/multiple-elements.html b/examples/multiple-elements.html index 8429e1b..4e12c79 100644 --- a/examples/multiple-elements.html +++ b/examples/multiple-elements.html @@ -4,7 +4,7 @@ jquery.slimscroll - multiple elements - + diff --git a/examples/nested.html b/examples/nested.html index 4b28d0e..ca55c72 100644 --- a/examples/nested.html +++ b/examples/nested.html @@ -4,7 +4,7 @@ jquery.slimscroll - top/bottom events - + diff --git a/examples/programmatic-scrolling.html b/examples/programmatic-scrolling.html index 168fb5b..49a3790 100644 --- a/examples/programmatic-scrolling.html +++ b/examples/programmatic-scrolling.html @@ -4,7 +4,7 @@ jquery.slimscroll - programmatic scrolling - + diff --git a/examples/rail.html b/examples/rail.html index 2bd6236..d6b24c1 100644 --- a/examples/rail.html +++ b/examples/rail.html @@ -4,7 +4,7 @@ jquery.slimscroll - rail options - + diff --git a/examples/scrollbar.html b/examples/scrollbar.html index 7a369d0..5e93e28 100644 --- a/examples/scrollbar.html +++ b/examples/scrollbar.html @@ -4,7 +4,7 @@ jquery.slimscroll - scrollbar options - + diff --git a/examples/start-position.html b/examples/start-position.html index dd68cb6..a067903 100644 --- a/examples/start-position.html +++ b/examples/start-position.html @@ -4,7 +4,7 @@ jquery.slimscroll - start position - + From 30e478f21ec2fb8d7419bd45c8cb9ecf8ee3c148 Mon Sep 17 00:00:00 2001 From: "@rochal" Date: Mon, 11 Mar 2013 11:07:06 +1100 Subject: [PATCH 04/67] Move prettyPrint to separate script block on example pages --- examples/allow-page-scroll.html | 6 ++++-- examples/chaining.html | 6 ++++-- examples/disable-fade-out.html | 6 ++++-- examples/height-width.html | 6 ++++-- examples/mouse-wheel.html | 6 ++++-- examples/multiple-elements.html | 6 ++++-- examples/nested.html | 7 ++++--- examples/programmatic-scrolling.html | 6 ++++-- examples/rail.html | 7 ++++--- examples/scrollbar.html | 6 ++++-- examples/start-position.html | 6 ++++-- 11 files changed, 44 insertions(+), 24 deletions(-) diff --git a/examples/allow-page-scroll.html b/examples/allow-page-scroll.html index d8730ad..0fe25ad 100644 --- a/examples/allow-page-scroll.html +++ b/examples/allow-page-scroll.html @@ -90,13 +90,15 @@

Facebook-style jQuery Scrollbar

allowPageScroll: true }); - //enable syntax highlighter - prettyPrint(); }); - + @@ -24,7 +24,7 @@

Facebook-style jQuery Scrollbar

  • Chaining
  • Mulitple bindings
  • Programmatic Scrolling
  • -
  • Scroll Events
  • +
  • Scroll Events
  • allowPageScroll option
  • disableFadeOut option
  • wheelStep option
  • @@ -50,25 +50,47 @@

    Facebook-style jQuery Scrollbar

    }); +
    +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus, felis interdum condimentum consectetur, nisl libero elementum eros, vehicula congue lacus eros non diam. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus mauris lorem, lacinia id tempus non, imperdiet et leo. Cras sit amet erat sit amet lacus egestas placerat. Aenean ultricies ultrices mauris ac congue. In vel tortor vel velit tristique tempus ac id nisi. Proin quis lorem velit. Nunc dui dui, blandit a ullamcorper vitae, congue fringilla lectus. Aliquam ultricies malesuada feugiat. Vestibulum placerat turpis et eros lobortis vel semper sapien pulvinar.

    +

    Pellentesque rhoncus aliquet porta. Sed vel magna eu turpis pharetra consequat ut vitae lectus. In molestie sollicitudin mi sit amet convallis. Aliquam erat volutpat. Nullam feugiat placerat ipsum eget malesuada. Nulla facilisis nunc non dolor vehicula pretium. Sed dui magna, sodales id pharetra non, ullamcorper eu sapien. Mauris ac consectetur leo. Mauris consequat, lectus ut bibendum pulvinar, leo magna feugiat enim, eu commodo lacus sem vel ante. Sed tempus metus eget leo mollis vulputate. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

    +

    Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed pulvinar rhoncus quam, vel semper tellus viverra id. Nulla rutrum porttitor odio, a rutrum purus gravida non. Etiam ac purus augue, eget vestibulum purus. Aenean venenatis ullamcorper augue, non consequat elit tempor sed. Donec velit sapien, volutpat sed ultricies egestas, semper a ante. Fusce dapibus, quam eget auctor suscipit, nibh leo posuere ante, at auctor nisi lacus in sem. Morbi interdum consectetur euismod. Cras accumsan est lacus. Nulla eleifend, eros vel consequat commodo, arcu nunc malesuada nunc, quis sagittis felis sem ac turpis.

    +

    Nulla rhoncus elementum convallis. Mauris condimentum aliquet egestas. Ut iaculis nisi eget tellus accumsan venenatis. Maecenas imperdiet aliquam porta. Aenean ultrices dolor sed quam laoreet varius. Curabitur condimentum blandit erat, quis accumsan eros interdum vitae. Curabitur ligula arcu, sollicitudin vitae iaculis sed, blandit sit amet enim. Morbi ullamcorper, metus vel mollis tristique, arcu turpis malesuada nisi, at dignissim lorem odio a orci. Proin ultrices, ipsum ut vestibulum interdum, libero felis auctor mi, vitae convallis nisl justo ac tellus. Integer nec lacinia turpis. Etiam massa nisl, rhoncus quis rutrum in, pretium eu leo. Proin a velit ut nulla laoreet vestibulum. Curabitur eu elit vitae felis auctor tincidunt. Curabitur tincidunt, metus sed sollicitudin cursus, quam elit commodo erat, ut tempor erat sapien vitae velit. Morbi nec viverra erat.

    +

    Nullam scelerisque facilisis pretium. Vivamus lectus leo, commodo ac sagittis ac, dictum a mi. Donec quis massa ut libero malesuada commodo in et risus. Fusce nunc dolor, aliquet vel rutrum in, molestie sit amet massa. Aliquam suscipit, justo a commodo condimentum, enim sapien fringilla ante, sed lobortis orci lectus in ante. Donec vel interdum est. Donec placerat cursus lacus, eu ultricies nisl tincidunt a. Fusce libero risus, sagittis eleifend iaculis aliquet, condimentum vitae diam. Suspendisse potenti. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Proin leo purus, sodales a venenatis luctus, faucibus ac enim. Sed id metus ac sem lobortis pretium. Mauris faucibus tempor scelerisque. Nunc vulputate interdum tortor, non tincidunt dui condimentum eget. Aenean in porttitor velit. Nam accumsan rhoncus risus id consectetur.

    +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus, felis interdum condimentum consectetur, nisl libero elementum eros, vehicula congue lacus eros non diam. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus mauris lorem, lacinia id tempus non, imperdiet et leo. Cras sit amet erat sit amet lacus egestas placerat. Aenean ultricies ultrices mauris ac congue. In vel tortor vel velit tristique tempus ac id nisi. Proin quis lorem velit. Nunc dui dui, blandit a ullamcorper vitae, congue fringilla lectus. Aliquam ultricies malesuada feugiat. Vestibulum placerat turpis et eros lobortis vel semper sapien pulvinar.

    +
    +
    + +
    +  $('#testDiv2').slimscroll().bind('slimscrolling', function(e, pos) {
    +    $('#testDivOut2').append("Scroll value: " + pos + "px");
    +  });
    +
    + @@ -12,25 +12,7 @@ Fork me on GitHub - +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus, felis interdum condimentum consectetur, nisl libero elementum eros, vehicula congue lacus eros non diam. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus mauris lorem, lacinia id tempus non, imperdiet et leo. Cras sit amet erat sit amet lacus egestas placerat. Aenean ultricies ultrices mauris ac congue. In vel tortor vel velit tristique tempus ac id nisi. Proin quis lorem velit. Nunc dui dui, blandit a ullamcorper vitae, congue fringilla lectus. Aliquam ultricies malesuada feugiat. Vestibulum placerat turpis et eros lobortis vel semper sapien pulvinar.

    diff --git a/examples/programmatic-scrolling.html b/examples/programmatic-scrolling.html index f9374b5..67d0a68 100644 --- a/examples/programmatic-scrolling.html +++ b/examples/programmatic-scrolling.html @@ -12,25 +12,7 @@ Fork me on GitHub - +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus, felis interdum condimentum consectetur, nisl libero elementum eros, vehicula congue lacus eros non diam. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus mauris lorem, lacinia id tempus non, imperdiet et leo. Cras sit amet erat sit amet lacus egestas placerat. Aenean ultricies ultrices mauris ac congue. In vel tortor vel velit tristique tempus ac id nisi. Proin quis lorem velit. Nunc dui dui, blandit a ullamcorper vitae, congue fringilla lectus. Aliquam ultricies malesuada feugiat. Vestibulum placerat turpis et eros lobortis vel semper sapien pulvinar.

    diff --git a/examples/rail.html b/examples/rail.html index 1ca241e..c6350f5 100644 --- a/examples/rail.html +++ b/examples/rail.html @@ -12,25 +12,7 @@ Fork me on GitHub - +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus, felis interdum condimentum consectetur, nisl libero elementum eros, vehicula congue lacus eros non diam. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus mauris lorem, lacinia id tempus non, imperdiet et leo. Cras sit amet erat sit amet lacus egestas placerat. Aenean ultricies ultrices mauris ac congue. In vel tortor vel velit tristique tempus ac id nisi. Proin quis lorem velit. Nunc dui dui, blandit a ullamcorper vitae, congue fringilla lectus. Aliquam ultricies malesuada feugiat. Vestibulum placerat turpis et eros lobortis vel semper sapien pulvinar.

    diff --git a/examples/scroll-events.html b/examples/scroll-events.html index 7967dd4..9ab9521 100644 --- a/examples/scroll-events.html +++ b/examples/scroll-events.html @@ -12,25 +12,7 @@ Fork me on GitHub - +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus, felis interdum condimentum consectetur, nisl libero elementum eros, vehicula congue lacus eros non diam. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus mauris lorem, lacinia id tempus non, imperdiet et leo. Cras sit amet erat sit amet lacus egestas placerat. Aenean ultricies ultrices mauris ac congue. In vel tortor vel velit tristique tempus ac id nisi. Proin quis lorem velit. Nunc dui dui, blandit a ullamcorper vitae, congue fringilla lectus. Aliquam ultricies malesuada feugiat. Vestibulum placerat turpis et eros lobortis vel semper sapien pulvinar.

    diff --git a/examples/scrollbar.html b/examples/scrollbar.html index cb3aad9..f2c401d 100644 --- a/examples/scrollbar.html +++ b/examples/scrollbar.html @@ -12,25 +12,7 @@ Fork me on GitHub - +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus, felis interdum condimentum consectetur, nisl libero elementum eros, vehicula congue lacus eros non diam. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus mauris lorem, lacinia id tempus non, imperdiet et leo. Cras sit amet erat sit amet lacus egestas placerat. Aenean ultricies ultrices mauris ac congue. In vel tortor vel velit tristique tempus ac id nisi. Proin quis lorem velit. Nunc dui dui, blandit a ullamcorper vitae, congue fringilla lectus. Aliquam ultricies malesuada feugiat. Vestibulum placerat turpis et eros lobortis vel semper sapien pulvinar.

    diff --git a/examples/start-position.html b/examples/start-position.html index 033778c..5e2e8dc 100644 --- a/examples/start-position.html +++ b/examples/start-position.html @@ -12,25 +12,7 @@ Fork me on GitHub - +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus, felis interdum condimentum consectetur, nisl libero elementum eros, vehicula congue lacus eros non diam. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus mauris lorem, lacinia id tempus non, imperdiet et leo. Cras sit amet erat sit amet lacus egestas placerat. Aenean ultricies ultrices mauris ac congue. In vel tortor vel velit tristique tempus ac id nisi. Proin quis lorem velit. Nunc dui dui, blandit a ullamcorper vitae, congue fringilla lectus. Aliquam ultricies malesuada feugiat. Vestibulum placerat turpis et eros lobortis vel semper sapien pulvinar.

    diff --git a/examples/style.css b/examples/style.css index 6d2965a..f12104a 100644 --- a/examples/style.css +++ b/examples/style.css @@ -4,7 +4,7 @@ h2 { font-size:10px; margin:0 } p { margin:5px 0; font-size:12px; } pre.prettyprint { padding:15px; border:1px solid #eee; border-radius:5px; background:#eee; border-bottom:3px solid; } .examples { border-radius:20px; background:#fff; padding:15px; - margin:0 125px 0 250px; border-collapse: collapse; border:1px solid #000; } + margin:0 150px 0 0; border-collapse: collapse; border:1px solid #000; } .slimScrollDiv { border:1px solid #eee; } #nav { position:fixed; top:0 left:0; background:#fff; padding:15px; border-radius:20px; width:200px; } #nav ul { list-style-type:square; list-style-position:inside; margin:20px 0 0 0; padding:0; } From 1ac38d2cef968d17b32a6a6283ebf39f2e229f03 Mon Sep 17 00:00:00 2001 From: "@rochal" Date: Mon, 11 Mar 2013 14:10:27 +1100 Subject: [PATCH 09/67] Add some meaningfull comments to the options section --- jquery.slimscroll.js | 50 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index bb532ad..d2ffd41 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -11,28 +11,66 @@ slimScroll: function(options) { var defaults = { - wheelStep : 20, + + // width in pixels of the visible scroll area width : 'auto', + + // height in pixels of the visible scroll area height : '250px', + + // width in pixels of the scrollbar and rail size : '7px', + + // scrollbar color, accepts any hex/color value color: '#000', + + // scrollbar position - left/right position : 'right', + + // distance in pixels between the side edge and the scrollbar distance : '1px', + + // default scroll position on load - top / bottom / $('selector') start : 'top', + + // sets scrollbar opacity opacity : .4, + + // enables always-on mode for the scrollbar alwaysVisible : false, + + // check if we should hide the scrollbar when user is hovering over disableFadeOut: false, + + // sets visibility of the rail railVisible : false, + + // sets rail color railColor : '#333', - railOpacity : '0.2', + + // sets rail opacity + railOpacity : .2, + + // whether we should use jQuery UI Draggable to enable bar dragging + railDraggable : true, + + // defautlt CSS class of the slimscroll rail railClass : 'slimScrollRail', + + // defautlt CSS class of the slimscroll bar barClass : 'slimScrollBar', + + // defautlt CSS class of the slimscroll wrapper wrapperClass : 'slimScrollDiv', + + // check if mousewheel should scroll the window if we reach top/bottom allowPageScroll : false, - scroll : 0, - touchScrollStep : 200, - // whether we should use jQuery UI Draggable to enable bar dragging - railDraggable : true + + // scroll amount applied to each mouse wheel step + wheelStep : 20, + + // scroll amount applied when user is using gestures + touchScrollStep : 200 }; var o = $.extend(defaults, options); From 8eb8459b76815c4a1e531f7fff187dbd98cadabd Mon Sep 17 00:00:00 2001 From: "@rochal" Date: Mon, 11 Mar 2013 14:17:07 +1100 Subject: [PATCH 10/67] Recalculate scrollbar size when .slimscroll() is called again. Extremely useful when we update the content dynamically / using ajax. --- examples/dynamic-content.html | 81 +++++++++++++++++++++++++++++++++++ jquery.slimscroll.js | 55 +++++++++++++----------- 2 files changed, 111 insertions(+), 25 deletions(-) create mode 100644 examples/dynamic-content.html diff --git a/examples/dynamic-content.html b/examples/dynamic-content.html new file mode 100644 index 0000000..0d667c8 --- /dev/null +++ b/examples/dynamic-content.html @@ -0,0 +1,81 @@ + + + +jquery.slimscroll - dynamic content + + + + + + + + + +Fork me on GitHub +
    + + +
    +
    + +
    +  // update content every second
    +  setInterval(function(){
    +    var el = $('<div></div>').html('#' + $('#testDiv').children().length)
    +            .css({ padding: '3px', border: '1px solid #ccc', margin: '5px' });
    +    $('#testDiv').append(el);
    +
    +    // update slimscroll every time content changes
    +    $('#testDiv').slimscroll();
    +  }, 1000);
    +
    +  $('#testDiv').slimscroll({
    +    alwaysVisible: true,
    +    height: 150
    +  });
    +  
    + + + +
    + + + + + + + \ No newline at end of file diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index d2ffd41..6b99585 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -100,7 +100,7 @@ getBarHeight(); // check if we should scroll existing instance - if (options) + if ($.isPlainObject(options)) { if ('scrollTo' in options) { @@ -253,7 +253,29 @@ } }); - var _onWheel = function(e) + // check start position + if (o.start === 'bottom') + { + // scroll content to bottom + bar.css({ top: me.outerHeight() - bar.outerHeight() }); + scrollContent(0, true); + } + else if (o.start !== 'top') + { + // assume jQuery selector + scrollContent($(o.start).position().top, null, true); + + // make sure bar stays hidden + if (!o.alwaysVisible) { bar.hide(); } + } + + // attach scroll events + attachWheel(); + + // set up initial height + getBarHeight(); + + function _onWheel(e) { // use mouse wheel only when mouse is over if (!isOverPanel) { return; } @@ -323,7 +345,7 @@ hideBar(); } - var attachWheel = function() + function attachWheel() { if (window.addEventListener) { @@ -336,18 +358,16 @@ } } - // attach scroll events - attachWheel(); - function getBarHeight() { // calculate scrollbar height and make sure it is not too small barHeight = Math.max((me.outerHeight() / me[0].scrollHeight) * me.outerHeight(), minBarHeight); bar.css({ height: barHeight + 'px' }); - } - // set up initial height - getBarHeight(); + // hide scrollbar if content is not long enough + var display = barHeight == me.outerHeight() ? 'none' : 'block'; + bar.css({ display: display }); + } function showBar() { @@ -356,7 +376,7 @@ clearTimeout(queueHide); // when bar reached top or bottom - if (percentScroll == ~~ percentScroll) + if (percentScroll == ~~percentScroll) { //release wheel releaseScroll = o.allowPageScroll; @@ -395,21 +415,6 @@ } } - // check start position - if (o.start == 'bottom') - { - // scroll content to bottom - bar.css({ top: me.outerHeight() - bar.outerHeight() }); - scrollContent(0, true); - } - else if (typeof o.start == 'object') - { - // scroll content - scrollContent($(o.start).position().top, null, true); - - // make sure bar stays hidden - if (!o.alwaysVisible) { bar.hide(); } - } }); // maintain chainability From cdcb258296a9150d6b6fa7850502cbe16febcf51 Mon Sep 17 00:00:00 2001 From: "@rochal" Date: Mon, 11 Mar 2013 14:22:37 +1100 Subject: [PATCH 11/67] Bump-up version. --- jquery.slimscroll.js | 2 +- jquery.slimscroll.min.js | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 6b99585..8645034 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -2,7 +2,7 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.0.9 + * Version: 1.1.0 * */ (function($) { diff --git a/jquery.slimscroll.min.js b/jquery.slimscroll.min.js index f73b58e..f3e1b0f 100644 --- a/jquery.slimscroll.min.js +++ b/jquery.slimscroll.min.js @@ -2,14 +2,14 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.0.9 + * Version: 1.1.0 * */ -(function(f){jQuery.fn.extend({slimScroll:function(l){var a=f.extend({wheelStep:20,width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:0.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:"0.2",railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,scroll:0,touchScrollStep:200},l);this.each(function(){function g(d,f,h){var e=d,g=b.outerHeight()-c.outerHeight();f&&(e=parseInt(c.css("top"))+ -d*parseInt(a.wheelStep)/100*c.outerHeight(),e=Math.min(Math.max(e,0),g),e=0=b.outerHeight()?n=!0:(c.stop(!0,!0).fadeIn("fast"),a.railVisible&&h.stop(!0,!0).fadeIn("fast"))}function m(){a.alwaysVisible||(w=setTimeout(function(){if((!a.disableFadeOut||!p)&&!t&&!u)c.fadeOut("slow"),h.fadeOut("slow")},1E3))}var p,t,u,w,y,s,j,x,A=30,n=!1,b=f(this);if(b.parent().hasClass("slimScrollDiv")){var k=b.scrollTop(),c=b.parent().find(".slimScrollBar"),h=b.parent().find(".slimScrollRail");r();if(l){if("scrollTo"in l)k=parseInt(a.scrollTo); -else if("scrollBy"in l)k+=parseInt(a.scrollBy);else if("destroy"in l){c.remove();h.remove();b.unwrap();return}g(k,!1,!0)}}else{a.height="auto"==a.height?b.parent().innerHeight():a.height;k=f("
    ").addClass(a.wrapperClass).css({position:"relative",overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",width:a.width,height:a.height});var h=f("
    ").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible? -"block":"none","border-radius":a.size,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=f("
    ").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible?"block":"none","border-radius":a.size,BorderRadius:a.size,MozBorderRadius:a.size,WebkitBorderRadius:a.size,zIndex:99}),z="right"==a.position?{right:a.distance}:{left:a.distance};h.css(z);c.css(z);b.wrap(k);b.parent().append(c);b.parent().append(h);c.draggable({axis:"y", -containment:"parent",start:function(){u=!0},stop:function(){u=!1;m()},drag:function(){g(0,f(this).position().top,!1)}});h.hover(function(){q()},function(){m()});c.hover(function(){t=!0},function(){t=!1});b.hover(function(){p=!0;q();m()},function(){p=!1;m()});b.bind("touchstart",function(a){a.originalEvent.touches.length&&(y=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){b.originalEvent.preventDefault();b.originalEvent.touches.length&&g((y-b.originalEvent.touches[0].pageY)/a.touchScrollStep, -!0)});var v=function(d){if(p){d=d||window.event;var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);f(d.target||d.srcTarget).closest("."+a.wrapperClass).is(b.parent())&&g(c,!0);d.preventDefault&&!n&&d.preventDefault();n||(d.returnValue=!1)}};(function(){window.addEventListener?(this.addEventListener("DOMMouseScroll",v,!1),this.addEventListener("mousewheel",v,!1)):document.attachEvent("onmousewheel",v)})();r();"bottom"==a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),g(0,!0)): -"object"==typeof a.start&&(g(f(a.start).position().top,null,!0),a.alwaysVisible||c.hide())}});return this}});jQuery.fn.extend({slimscroll:jQuery.fn.slimScroll})})(jQuery); \ No newline at end of file +(function(f){jQuery.fn.extend({slimScroll:function(l){var a=f.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:0.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:0.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200},l);this.each(function(){function r(d){if(n){d=d||window.event;var c=0;d.wheelDelta&&(c=-d.wheelDelta/ +120);d.detail&&(c=d.detail/3);f(d.target||d.srcTarget).closest("."+a.wrapperClass).is(b.parent())&&g(c,!0);d.preventDefault&&!p&&d.preventDefault();p||(d.returnValue=!1)}}function g(d,f,h){var e=d,g=b.outerHeight()-c.outerHeight();f&&(e=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),e=Math.min(Math.max(e,0),g),e=0=b.outerHeight()?p=!0:(c.stop(!0,!0).fadeIn("fast"),a.railVisible&&h.stop(!0,!0).fadeIn("fast"))}function m(){a.alwaysVisible||(w=setTimeout(function(){if((!a.disableFadeOut||!n)&&!u&&!v)c.fadeOut("slow"),h.fadeOut("slow")},1E3))}var n,u,v,w,y,q,j,x,B=30,p=!1,b=f(this);if(b.parent().hasClass(a.wrapperClass)){var k=b.scrollTop(),c=b.parent().find("."+a.barClass),h=b.parent().find("."+a.railClass);t();if(f.isPlainObject(l)){if("scrollTo"in l)k= +parseInt(a.scrollTo);else if("scrollBy"in l)k+=parseInt(a.scrollBy);else if("destroy"in l){c.remove();h.remove();b.unwrap();return}g(k,!1,!0)}}else{a.height="auto"==a.height?b.parent().innerHeight():a.height;k=f("
    ").addClass(a.wrapperClass).css({position:"relative",overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",width:a.width,height:a.height});var h=f("
    ").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&& +a.railVisible?"block":"none","border-radius":a.size,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=f("
    ").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible?"block":"none","border-radius":a.size,BorderRadius:a.size,MozBorderRadius:a.size,WebkitBorderRadius:a.size,zIndex:99}),z="right"==a.position?{right:a.distance}:{left:a.distance};h.css(z);c.css(z);b.wrap(k);b.parent().append(c);b.parent().append(h); +a.railDraggable&&c.draggable({axis:"y",containment:"parent",start:function(){v=!0},stop:function(){v=!1;m()},drag:function(){g(0,f(this).position().top,!1)}});h.hover(function(){s()},function(){m()});c.hover(function(){u=!0},function(){u=!1});b.hover(function(){n=!0;s();m()},function(){n=!1;m()});b.bind("touchstart",function(a){a.originalEvent.touches.length&&(y=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){b.originalEvent.preventDefault();b.originalEvent.touches.length&&g((y- +b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0)});"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),g(0,!0)):"top"!==a.start&&(g(f(a.start).position().top,null,!0),a.alwaysVisible||c.hide());A();t()}});return this}});jQuery.fn.extend({slimscroll:jQuery.fn.slimScroll})})(jQuery); \ No newline at end of file From a5fb1b6decbe56cb0322f1f354489f2ad29a8df5 Mon Sep 17 00:00:00 2001 From: "@rochal" Date: Sat, 16 Mar 2013 13:39:36 +1100 Subject: [PATCH 12/67] Bump-up version to sync with plugins page. --- jquery.slimscroll.js | 2 +- jquery.slimscroll.min.js | 2 +- slimScroll.jquery.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 8645034..eada791 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -2,7 +2,7 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.1.0 + * Version: 1.1.1 * */ (function($) { diff --git a/jquery.slimscroll.min.js b/jquery.slimscroll.min.js index f3e1b0f..4a65411 100644 --- a/jquery.slimscroll.min.js +++ b/jquery.slimscroll.min.js @@ -2,7 +2,7 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.1.0 + * Version: 1.1.1 * */ (function(f){jQuery.fn.extend({slimScroll:function(l){var a=f.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:0.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:0.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200},l);this.each(function(){function r(d){if(n){d=d||window.event;var c=0;d.wheelDelta&&(c=-d.wheelDelta/ diff --git a/slimScroll.jquery.json b/slimScroll.jquery.json index 6f6ed30..e87a967 100644 --- a/slimScroll.jquery.json +++ b/slimScroll.jquery.json @@ -1,6 +1,6 @@ { "name" : "slimScroll", - "version" : "1.0.6", + "version" : "1.1.1", "title" : "jQuery slimScroll scrollbar", "description" : "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", "keywords" : ["scrollbar", "scroll", "slimscroll", "scrollable", "scrolling", "scroller", "ui"], From 7b3a56e2a61bc150fef4a8bdca3db19ea8e19a41 Mon Sep 17 00:00:00 2001 From: chawkinsuf Date: Sat, 16 Mar 2013 16:28:43 -0400 Subject: [PATCH 13/67] Add ability to force a resize after contents of an existing slimscroll object have changed --- jquery.slimscroll.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index eada791..15062e0 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -102,6 +102,15 @@ // check if we should scroll existing instance if ($.isPlainObject(options)) { + // Pass height: auto to an existing slimscroll object to force a resize after contents have changed + if ( 'height' in options && options.height == 'auto' ) { + me.parent().css('height', 'auto'); + me.css('height', 'auto'); + var height = me.parent().parent().innerHeight(); + me.parent().css('height', height); + me.css('height', height); + } + if ('scrollTo' in options) { // jump to a static point From 6f219d5385fcec2dfcdcd89d4f1ea64f9b28d2bc Mon Sep 17 00:00:00 2001 From: Muhammad Adeel Nawaz Date: Wed, 20 Mar 2013 16:45:56 +0500 Subject: [PATCH 14/67] Update jquery.slimscroll.js Fixed the bug: When user sets "allowPageScroll" to true, the parent should only scroll when the scroll in on the boundary. But when the scroll touched one of the boundaries, the parent started to scroll even when the scroll in not at boundaries Solution: The variable "releaseScroll", one set to true, was never set to false. So I set it to false if the scroll is not at the end of the page. --- jquery.slimscroll.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index eada791..8ec3b1c 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -388,6 +388,10 @@ me.trigger('slimscroll', msg); } } + else + { + releaseScroll = false; + } lastScroll = percentScroll; // show only when required From c6eb8e008fcb21a4f55716a4e1833e010de2bd0a Mon Sep 17 00:00:00 2001 From: zensh Date: Thu, 18 Apr 2013 11:41:56 +0800 Subject: [PATCH 15/67] fix, when scrollbar height equal parent height, auto hide --- jquery.slimscroll.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 15062e0..bd88867 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -374,8 +374,9 @@ bar.css({ height: barHeight + 'px' }); // hide scrollbar if content is not long enough - var display = barHeight == me.outerHeight() ? 'none' : 'block'; + var display = me.outerHeight() - barHeight <= 1 ? 'none' : 'block'; bar.css({ display: display }); + if (o.railVisible) { rail.css({ display: display }); } } function showBar() @@ -400,7 +401,7 @@ lastScroll = percentScroll; // show only when required - if(barHeight >= me.outerHeight()) { + if(barHeight >= me.outerHeight() - 1) { //allow window scroll releaseScroll = true; return; From af2152b10d8918cb86ceb7f28727e306de9b1857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Caron=20L=27=C3=89cuyer?= Date: Thu, 18 Apr 2013 14:58:34 -0400 Subject: [PATCH 16/67] Take in account the padding of the containing element when height=auto Uses parent.parent.height, instead of parent.parent.innerHeight to take in acount the padding of the containing element whent the height is set to 'auto' --- jquery.slimscroll.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 15062e0..45eb2d9 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -106,7 +106,7 @@ if ( 'height' in options && options.height == 'auto' ) { me.parent().css('height', 'auto'); me.css('height', 'auto'); - var height = me.parent().parent().innerHeight(); + var height = me.parent().parent().height(); me.parent().css('height', height); me.css('height', height); } @@ -138,7 +138,7 @@ } // optionally set height to the parent's height - o.height = (o.height == 'auto') ? me.parent().innerHeight() : o.height; + o.height = (o.height == 'auto') ? me.parent().height() : o.height; // wrap content var wrapper = $(divS) From b3e009db1e674e61e294ccb2de6276968b8f5951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Caron=20L=27=C3=89cuyer?= Date: Thu, 18 Apr 2013 15:55:54 -0400 Subject: [PATCH 17/67] Oversize the rail and bar when hovered, make it easier for the user to select the bar --- jquery.slimscroll.js | 45 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 45eb2d9..78e224c 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -20,6 +20,9 @@ // width in pixels of the scrollbar and rail size : '7px', + + // oversize width in pixels of the scrollbar and rail + overSize : '14px', // scrollbar color, accepts any hex/color value color: '#000', @@ -78,7 +81,7 @@ // do it for every element that matches selector this.each(function(){ - var isOverPanel, isOverBar, isDragg, queueHide, touchDif, + var isOverPanel, isOverBar, isOverRail, isDragg, queueHide, touchDif, barHeight, percentScroll, lastScroll, divS = '
    ', minBarHeight = 30, @@ -219,16 +222,24 @@ // on rail over rail.hover(function(){ + isOverRail = true; showBar(); + overSizeBar(); + console.log("over"); }, function(){ + isOverRail = true; hideBar(); + normalSizeBar(); + console.log("outover"); }); // on bar over bar.hover(function(){ isOverBar = true; + overSizeBar(); }, function(){ isOverBar = false; + normalSizeBar(); }); // show on parent mouseover @@ -374,10 +385,34 @@ bar.css({ height: barHeight + 'px' }); // hide scrollbar if content is not long enough - var display = barHeight == me.outerHeight() ? 'none' : 'block'; + var display = me.outerHeight() - barHeight <= 1 ? 'none' : 'block'; bar.css({ display: display }); + if (o.railVisible) { rail.css({ display: display }); } } + function overSizeBar(){ + if (isOverBar || isOverRail){ + bar.css('width', o.overSize); + rail.css('width', o.overSize); + } + } + + function normalSizeBar(check){ + if(typeof check === "undefined"){ + check = true; + } + if (check){ + if (!isOverBar && !isOverRail && !isDragg){ + bar.css('width', o.size); + rail.css('width', o.size); + } + }else{ + bar.css('width', o.size); + rail.css('width', o.size); + } + + } + function showBar() { // recalculate bar height @@ -400,7 +435,7 @@ lastScroll = percentScroll; // show only when required - if(barHeight >= me.outerHeight()) { + if(barHeight >= me.outerHeight() - 1) { //allow window scroll releaseScroll = true; return; @@ -419,9 +454,11 @@ { bar.fadeOut('slow'); rail.fadeOut('slow'); + normalSizeBar(false); } }, 1000); } + } }); @@ -435,4 +472,4 @@ slimscroll: jQuery.fn.slimScroll }); -})(jQuery); +})(jQuery); \ No newline at end of file From 718d3ca28d3823ff2be0674585fc328a91957524 Mon Sep 17 00:00:00 2001 From: Wing Date: Wed, 15 May 2013 19:20:34 +0900 Subject: [PATCH 18/67] Check if jQuery UI draggable is loaded --- jquery.slimscroll.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 15062e0..0e13f5c 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -202,7 +202,7 @@ me.parent().append(rail); // make it draggable - if (o.railDraggable) + if (o.railDraggable && $.ui && typeof($.ui.draggable) == 'function') { bar.draggable({ axis: 'y', From daa61fe6b9880bc2958231b5313b97759b839ca5 Mon Sep 17 00:00:00 2001 From: Jack Godwin Date: Tue, 4 Jun 2013 13:07:59 -0400 Subject: [PATCH 19/67] Fixed IE8 mouse wheel issue #72 --- jquery.slimscroll.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 15062e0..8c54835 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -295,7 +295,7 @@ if (e.wheelDelta) { delta = -e.wheelDelta/120; } if (e.detail) { delta = e.detail / 3; } - var target = e.target || e.srcTarget; + var target = e.target || e.srcTarget || e.srcElement; if ($(target).closest('.' + o.wrapperClass).is(me.parent())) { // scroll content scrollContent(delta, true); From 55f2dbd8d9b6d26b33ebfac9b044e280ca5150f0 Mon Sep 17 00:00:00 2001 From: Piotr Rochala Date: Sun, 9 Jun 2013 11:52:54 +1000 Subject: [PATCH 20/67] Revert "Oversize the rail and bar when hovered, make it easier for the user to select the bar" This reverts commit b3e009db1e674e61e294ccb2de6276968b8f5951. --- jquery.slimscroll.js | 43 +++---------------------------------------- 1 file changed, 3 insertions(+), 40 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 7835391..66dde9c 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -20,9 +20,6 @@ // width in pixels of the scrollbar and rail size : '7px', - - // oversize width in pixels of the scrollbar and rail - overSize : '14px', // scrollbar color, accepts any hex/color value color: '#000', @@ -81,7 +78,7 @@ // do it for every element that matches selector this.each(function(){ - var isOverPanel, isOverBar, isOverRail, isDragg, queueHide, touchDif, + var isOverPanel, isOverBar, isDragg, queueHide, touchDif, barHeight, percentScroll, lastScroll, divS = '
    ', minBarHeight = 30, @@ -222,24 +219,16 @@ // on rail over rail.hover(function(){ - isOverRail = true; showBar(); - overSizeBar(); - console.log("over"); }, function(){ - isOverRail = true; hideBar(); - normalSizeBar(); - console.log("outover"); }); // on bar over bar.hover(function(){ isOverBar = true; - overSizeBar(); }, function(){ isOverBar = false; - normalSizeBar(); }); // show on parent mouseover @@ -385,34 +374,10 @@ bar.css({ height: barHeight + 'px' }); // hide scrollbar if content is not long enough - var display = me.outerHeight() - barHeight <= 1 ? 'none' : 'block'; + var display = barHeight == me.outerHeight() ? 'none' : 'block'; bar.css({ display: display }); - if (o.railVisible) { rail.css({ display: display }); } } - function overSizeBar(){ - if (isOverBar || isOverRail){ - bar.css('width', o.overSize); - rail.css('width', o.overSize); - } - } - - function normalSizeBar(check){ - if(typeof check === "undefined"){ - check = true; - } - if (check){ - if (!isOverBar && !isOverRail && !isDragg){ - bar.css('width', o.size); - rail.css('width', o.size); - } - }else{ - bar.css('width', o.size); - rail.css('width', o.size); - } - - } - function showBar() { // recalculate bar height @@ -439,7 +404,7 @@ lastScroll = percentScroll; // show only when required - if(barHeight >= me.outerHeight() - 1) { + if(barHeight >= me.outerHeight()) { //allow window scroll releaseScroll = true; return; @@ -458,11 +423,9 @@ { bar.fadeOut('slow'); rail.fadeOut('slow'); - normalSizeBar(false); } }, 1000); } - } }); From 2e563d4c7b88cba21e504cecbcd993d004204ce8 Mon Sep 17 00:00:00 2001 From: Piotr Rochala Date: Sun, 9 Jun 2013 12:00:16 +1000 Subject: [PATCH 21/67] Bump up version. --- jquery.slimscroll.js | 2 +- jquery.slimscroll.min.js | 18 +++++++++--------- slimScroll.jquery.json | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 66dde9c..ad6137f 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -2,7 +2,7 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.1.1 + * Version: 1.2.0 * */ (function($) { diff --git a/jquery.slimscroll.min.js b/jquery.slimscroll.min.js index 4a65411..dd63f62 100644 --- a/jquery.slimscroll.min.js +++ b/jquery.slimscroll.min.js @@ -2,14 +2,14 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.1.1 + * Version: 1.2.0 * */ -(function(f){jQuery.fn.extend({slimScroll:function(l){var a=f.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:0.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:0.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200},l);this.each(function(){function r(d){if(n){d=d||window.event;var c=0;d.wheelDelta&&(c=-d.wheelDelta/ -120);d.detail&&(c=d.detail/3);f(d.target||d.srcTarget).closest("."+a.wrapperClass).is(b.parent())&&g(c,!0);d.preventDefault&&!p&&d.preventDefault();p||(d.returnValue=!1)}}function g(d,f,h){var e=d,g=b.outerHeight()-c.outerHeight();f&&(e=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),e=Math.min(Math.max(e,0),g),e=0=b.outerHeight()?p=!0:(c.stop(!0,!0).fadeIn("fast"),a.railVisible&&h.stop(!0,!0).fadeIn("fast"))}function m(){a.alwaysVisible||(w=setTimeout(function(){if((!a.disableFadeOut||!n)&&!u&&!v)c.fadeOut("slow"),h.fadeOut("slow")},1E3))}var n,u,v,w,y,q,j,x,B=30,p=!1,b=f(this);if(b.parent().hasClass(a.wrapperClass)){var k=b.scrollTop(),c=b.parent().find("."+a.barClass),h=b.parent().find("."+a.railClass);t();if(f.isPlainObject(l)){if("scrollTo"in l)k= -parseInt(a.scrollTo);else if("scrollBy"in l)k+=parseInt(a.scrollBy);else if("destroy"in l){c.remove();h.remove();b.unwrap();return}g(k,!1,!0)}}else{a.height="auto"==a.height?b.parent().innerHeight():a.height;k=f("
    ").addClass(a.wrapperClass).css({position:"relative",overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",width:a.width,height:a.height});var h=f("
    ").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&& -a.railVisible?"block":"none","border-radius":a.size,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=f("
    ").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible?"block":"none","border-radius":a.size,BorderRadius:a.size,MozBorderRadius:a.size,WebkitBorderRadius:a.size,zIndex:99}),z="right"==a.position?{right:a.distance}:{left:a.distance};h.css(z);c.css(z);b.wrap(k);b.parent().append(c);b.parent().append(h); -a.railDraggable&&c.draggable({axis:"y",containment:"parent",start:function(){v=!0},stop:function(){v=!1;m()},drag:function(){g(0,f(this).position().top,!1)}});h.hover(function(){s()},function(){m()});c.hover(function(){u=!0},function(){u=!1});b.hover(function(){n=!0;s();m()},function(){n=!1;m()});b.bind("touchstart",function(a){a.originalEvent.touches.length&&(y=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){b.originalEvent.preventDefault();b.originalEvent.touches.length&&g((y- -b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0)});"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),g(0,!0)):"top"!==a.start&&(g(f(a.start).position().top,null,!0),a.alwaysVisible||c.hide());A();t()}});return this}});jQuery.fn.extend({slimscroll:jQuery.fn.slimScroll})})(jQuery); \ No newline at end of file +(function(e){jQuery.fn.extend({slimScroll:function(h){var a=e.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:0.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:0.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200},h);this.each(function(){function s(d){if(q){d=d||window.event;var c=0;d.wheelDelta&&(c=-d.wheelDelta/ +120);d.detail&&(c=d.detail/3);e(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&k(c,!0);d.preventDefault&&!m&&d.preventDefault();m||(d.returnValue=!1)}}function k(d,e,h){var f=d,g=b.outerHeight()-c.outerHeight();e&&(f=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),f=Math.min(Math.max(f,0),g),f=0=b.outerHeight()?m=!0:(c.stop(!0,!0).fadeIn("fast"),a.railVisible&&g.stop(!0,!0).fadeIn("fast"))}function n(){a.alwaysVisible||(x=setTimeout(function(){if((!a.disableFadeOut||!q)&&!v&&!w)c.fadeOut("slow"),g.fadeOut("slow")},1E3))}var q,v,w,x,z,r,j,y,B=30,m=!1,b=e(this);if(b.parent().hasClass(a.wrapperClass)){var l=b.scrollTop(),c=b.parent().find("."+a.barClass),g=b.parent().find("."+a.railClass);u();if(e.isPlainObject(h)){if("height"in +h&&"auto"==h.height){b.parent().css("height","auto");b.css("height","auto");var p=b.parent().parent().height();b.parent().css("height",p);b.css("height",p)}if("scrollTo"in h)l=parseInt(a.scrollTo);else if("scrollBy"in h)l+=parseInt(a.scrollBy);else if("destroy"in h){c.remove();g.remove();b.unwrap();return}k(l,!1,!0)}}else{a.height="auto"==a.height?b.parent().height():a.height;l=e("
    ").addClass(a.wrapperClass).css({position:"relative",overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden", +width:a.width,height:a.height});var g=e("
    ").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.size,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=e("
    ").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible?"block":"none","border-radius":a.size,BorderRadius:a.size,MozBorderRadius:a.size,WebkitBorderRadius:a.size, +zIndex:99}),p="right"==a.position?{right:a.distance}:{left:a.distance};g.css(p);c.css(p);b.wrap(l);b.parent().append(c);b.parent().append(g);a.railDraggable&&(e.ui&&"function"==typeof e.ui.draggable)&&c.draggable({axis:"y",containment:"parent",start:function(){w=!0},stop:function(){w=!1;n()},drag:function(){k(0,e(this).position().top,!1)}});g.hover(function(){t()},function(){n()});c.hover(function(){v=!0},function(){v=!1});b.hover(function(){q=!0;t();n()},function(){q=!1;n()});b.bind("touchstart", +function(a){a.originalEvent.touches.length&&(z=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){b.originalEvent.preventDefault();b.originalEvent.touches.length&&k((z-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0)});"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),k(0,!0)):"top"!==a.start&&(k(e(a.start).position().top,null,!0),a.alwaysVisible||c.hide());A();u()}});return this}});jQuery.fn.extend({slimscroll:jQuery.fn.slimScroll})})(jQuery); \ No newline at end of file diff --git a/slimScroll.jquery.json b/slimScroll.jquery.json index e87a967..41174e6 100644 --- a/slimScroll.jquery.json +++ b/slimScroll.jquery.json @@ -1,6 +1,6 @@ { "name" : "slimScroll", - "version" : "1.1.1", + "version" : "1.2.0", "title" : "jQuery slimScroll scrollbar", "description" : "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", "keywords" : ["scrollbar", "scroll", "slimscroll", "scrollable", "scrolling", "scroller", "ui"], From 47ed5ccc0fefe7c127ac1a2c9b220b291cff057e Mon Sep 17 00:00:00 2001 From: Sergey Kirillov Date: Wed, 26 Jun 2013 17:55:32 +0300 Subject: [PATCH 22/67] Fixed problem where bar position was set before bar height was calculated. --- jquery.slimscroll.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index ad6137f..eac622d 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -262,6 +262,9 @@ } }); + // set up initial height + getBarHeight(); + // check start position if (o.start === 'bottom') { @@ -281,9 +284,6 @@ // attach scroll events attachWheel(); - // set up initial height - getBarHeight(); - function _onWheel(e) { // use mouse wheel only when mouse is over From 29b4a9a740580b472011c4949fe39fc7f18f1cab Mon Sep 17 00:00:00 2001 From: UglyColor Date: Wed, 31 Jul 2013 14:34:33 +0800 Subject: [PATCH 23/67] make it draggable and no longer dependent on the jqueryUI jqueryUI is too fat!!! --- jquery.slimscroll.js | 49 +++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index ad6137f..5740963 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -202,18 +202,43 @@ me.parent().append(rail); // make it draggable - if (o.railDraggable && $.ui && typeof($.ui.draggable) == 'function') - { - bar.draggable({ - axis: 'y', - containment: 'parent', - start: function() { isDragg = true; }, - stop: function() { isDragg = false; hideBar(); }, - drag: function(e) - { - // scroll content - scrollContent(0, $(this).position().top, false); - } + // if (o.railDraggable && $.ui && typeof($.ui.draggable) == 'function') + // { + // bar.draggable({ + // axis: 'y', + // containment: 'parent', + // start: function() { isDragg = true; }, + // stop: function() { isDragg = false; hideBar(); }, + // drag: function(e) + // { + // // scroll content + // scrollContent(0, $(this).position().top, false); + // } + // }); + // } + // make it draggable and no longer dependent on the jqueryUI + if (o.railDraggable){ + bar.bind("mousedown", function(e) { + var $doc = $(document); + isDragg = true; + t = parseFloat(bar.css('top')); + pageY = e.pageY; + + $doc.bind("mousemove.slimscroll", function(e){ + currTop = t + e.pageY - pageY; + bar.css('top', currTop); + scrollContent(0, bar.position().top, false);// scroll content + }); + + $doc.bind("mouseup.slimscroll", function(e) { + isDragg = false;hideBar(); + $doc.unbind('.slimscroll'); + }); + return false; + }).bind("selectstart.slimscroll", function(e){ + e.stopPropagation(); + e.preventDefault(); + return false; }); } From e52ae2b3c0200d12c364fa51c30fcbde744782ab Mon Sep 17 00:00:00 2001 From: aidik Date: Fri, 2 Aug 2013 12:46:54 +0200 Subject: [PATCH 24/67] Variable BorderRadius Variable to set border radius was added. --- jquery.slimscroll.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index ad6137f..904b77e 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -70,7 +70,13 @@ wheelStep : 20, // scroll amount applied when user is using gestures - touchScrollStep : 200 + touchScrollStep : 200, + + // sets border radius + borderRadius: '7px', + + // sets border radius of the rail + railBorderRadius: '7px' }; var o = $.extend(defaults, options); @@ -166,7 +172,7 @@ position: 'absolute', top: 0, display: (o.alwaysVisible && o.railVisible) ? 'block' : 'none', - 'border-radius': o.size, + 'border-radius': o.railBorderRadius, background: o.railColor, opacity: o.railOpacity, zIndex: 90 @@ -182,10 +188,10 @@ top: 0, opacity: o.opacity, display: o.alwaysVisible ? 'block' : 'none', - 'border-radius' : o.size, - BorderRadius: o.size, - MozBorderRadius: o.size, - WebkitBorderRadius: o.size, + 'border-radius' : o.borderRadius, + BorderRadius: o.borderRadius, + MozBorderRadius: o.borderRadius, + WebkitBorderRadius: o.borderRadius, zIndex: 99 }); From a96f2a6954e7a1188b43e00c9f4e0ee7f06852ad Mon Sep 17 00:00:00 2001 From: Anchor Date: Fri, 2 Aug 2013 21:11:45 -0700 Subject: [PATCH 25/67] Fixes issue #65 Add listener for mozilla specific event "MozMousePixelScroll" --- jquery.slimscroll.js | 1 + 1 file changed, 1 insertion(+) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 904b77e..c4ef721 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -366,6 +366,7 @@ { this.addEventListener('DOMMouseScroll', _onWheel, false ); this.addEventListener('mousewheel', _onWheel, false ); + this.addEventListener('MozMousePixelScroll', _onWheel, false ); } else { From 879947b473fea892eda9a28f41f8d0163483605d Mon Sep 17 00:00:00 2001 From: Bernhard Sirlinger Date: Mon, 12 Aug 2013 18:03:09 +0200 Subject: [PATCH 26/67] Fix several touch issues --- jquery.slimscroll.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 904b77e..b30c7c1 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -257,14 +257,18 @@ }); me.bind('touchmove', function(e){ - // prevent scrolling the page - e.originalEvent.preventDefault(); + // prevent scrolling the page if necessary + if(!releaseScroll) + { + e.originalEvent.preventDefault(); + } if (e.originalEvent.touches.length) { // see how far user swiped var diff = (touchDif - e.originalEvent.touches[0].pageY) / o.touchScrollStep; // scroll content scrollContent(diff, true); + touchDif = e.originalEvent.touches[0].pageY; } }); @@ -314,6 +318,7 @@ function scrollContent(y, isWheel, isJump) { + releaseScroll = false; var delta = y; var maxTop = me.outerHeight() - bar.outerHeight(); From 9439d268c34fd0f789f28041db9c6cf6740eee9f Mon Sep 17 00:00:00 2001 From: "@rochal" Date: Sun, 18 Aug 2013 17:05:12 +1000 Subject: [PATCH 27/67] Remove jQuery draggable from examples --- examples/allow-page-scroll.html | 1 - examples/chaining.html | 1 - examples/disable-fade-out.html | 2 +- examples/dynamic-content.html | 2 +- examples/height-width.html | 2 +- examples/mouse-wheel.html | 2 +- examples/multiple-elements.html | 2 +- examples/nested.html | 2 +- examples/programmatic-scrolling.html | 2 +- examples/rail.html | 3 +-- examples/scroll-events.html | 2 +- examples/scrollbar.html | 2 +- examples/start-position.html | 2 +- 13 files changed, 11 insertions(+), 14 deletions(-) diff --git a/examples/allow-page-scroll.html b/examples/allow-page-scroll.html index 2c584b2..b594de3 100644 --- a/examples/allow-page-scroll.html +++ b/examples/allow-page-scroll.html @@ -4,7 +4,6 @@ jquery.slimscroll - allow page scroll - diff --git a/examples/chaining.html b/examples/chaining.html index ef54fa6..fead426 100644 --- a/examples/chaining.html +++ b/examples/chaining.html @@ -4,7 +4,6 @@ jquery.slimscroll - chaining - diff --git a/examples/disable-fade-out.html b/examples/disable-fade-out.html index 1420e88..7c8e6fa 100644 --- a/examples/disable-fade-out.html +++ b/examples/disable-fade-out.html @@ -4,7 +4,7 @@ jquery.slimscroll - disable fade out - + diff --git a/examples/dynamic-content.html b/examples/dynamic-content.html index 0d667c8..1ac5e56 100644 --- a/examples/dynamic-content.html +++ b/examples/dynamic-content.html @@ -4,7 +4,7 @@ jquery.slimscroll - dynamic content - + diff --git a/examples/height-width.html b/examples/height-width.html index 17fa9ba..4b006b0 100644 --- a/examples/height-width.html +++ b/examples/height-width.html @@ -4,7 +4,7 @@ jquery.slimscroll - height / width - + diff --git a/examples/mouse-wheel.html b/examples/mouse-wheel.html index f6c0dcf..434c80c 100644 --- a/examples/mouse-wheel.html +++ b/examples/mouse-wheel.html @@ -4,7 +4,7 @@ jquery.slimscroll - mouse wheel - + diff --git a/examples/multiple-elements.html b/examples/multiple-elements.html index 92099c7..6f98b32 100644 --- a/examples/multiple-elements.html +++ b/examples/multiple-elements.html @@ -4,7 +4,7 @@ jquery.slimscroll - multiple elements - + diff --git a/examples/nested.html b/examples/nested.html index adc465d..92bd599 100644 --- a/examples/nested.html +++ b/examples/nested.html @@ -4,7 +4,7 @@ jquery.slimscroll - nested elements - + diff --git a/examples/programmatic-scrolling.html b/examples/programmatic-scrolling.html index 67d0a68..163e753 100644 --- a/examples/programmatic-scrolling.html +++ b/examples/programmatic-scrolling.html @@ -4,7 +4,7 @@ jquery.slimscroll - programmatic scrolling - + diff --git a/examples/rail.html b/examples/rail.html index c6350f5..8e55e27 100644 --- a/examples/rail.html +++ b/examples/rail.html @@ -4,7 +4,7 @@ jquery.slimscroll - rail options - + @@ -132,7 +132,6 @@
    -  // This also removes dependency on jQuery UI
       $('#testDiv5').slimscroll({
         railDraggable: false
       });
    diff --git a/examples/scroll-events.html b/examples/scroll-events.html
    index 9ab9521..9eabbdc 100644
    --- a/examples/scroll-events.html
    +++ b/examples/scroll-events.html
    @@ -4,7 +4,7 @@
     jquery.slimscroll - top/bottom events
     
     
    -
    +
     
     
     
    diff --git a/examples/scrollbar.html b/examples/scrollbar.html
    index f2c401d..9f13b03 100644
    --- a/examples/scrollbar.html
    +++ b/examples/scrollbar.html
    @@ -4,7 +4,7 @@
     jquery.slimscroll - scrollbar options
     
     
    -
    +
     
     
     
    diff --git a/examples/start-position.html b/examples/start-position.html
    index 5e2e8dc..8afdda6 100644
    --- a/examples/start-position.html
    +++ b/examples/start-position.html
    @@ -4,7 +4,7 @@
     jquery.slimscroll - start position
     
     
    -
    +
     
     
     
    
    From 854f7c5313eab2c24627f4cf1760a9274f786ca9 Mon Sep 17 00:00:00 2001
    From: "@rochal" 
    Date: Sun, 18 Aug 2013 17:05:26 +1000
    Subject: [PATCH 28/67] Add railBorderRadius to examples
    
    ---
     examples/rail.html | 6 ++++--
     1 file changed, 4 insertions(+), 2 deletions(-)
    
    diff --git a/examples/rail.html b/examples/rail.html
    index 8e55e27..4f77f34 100644
    --- a/examples/rail.html
    +++ b/examples/rail.html
    @@ -109,7 +109,8 @@
     
     
       $('#testDiv4').slimscroll({
    -    railVisible: true
    +    railVisible: true,
    +    railBorderRadius: 0
       });
     
    @@ -158,7 +159,8 @@ }); $('#testDiv4').slimscroll({ - railVisible: true + railVisible: true, + railBorderRadius: 0 }); $('#testDiv5').slimscroll({ From 41b13f6508e0ce60a8948c8e6840e1b8d2590f73 Mon Sep 17 00:00:00 2001 From: "@rochal" Date: Sun, 18 Aug 2013 17:05:59 +1000 Subject: [PATCH 29/67] Bump-up version, remove commented out code --- jquery.slimscroll.js | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index e27cc80..2ea5b08 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -2,7 +2,7 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.2.0 + * Version: 1.3.0 * */ (function($) { @@ -40,7 +40,7 @@ alwaysVisible : false, // check if we should hide the scrollbar when user is hovering over - disableFadeOut: false, + disableFadeOut : false, // sets visibility of the rail railVisible : false, @@ -71,12 +71,12 @@ // scroll amount applied when user is using gestures touchScrollStep : 200, - + // sets border radius borderRadius: '7px', - + // sets border radius of the rail - railBorderRadius: '7px' + railBorderRadius : '7px' }; var o = $.extend(defaults, options); @@ -207,28 +207,13 @@ me.parent().append(bar); me.parent().append(rail); - // make it draggable - // if (o.railDraggable && $.ui && typeof($.ui.draggable) == 'function') - // { - // bar.draggable({ - // axis: 'y', - // containment: 'parent', - // start: function() { isDragg = true; }, - // stop: function() { isDragg = false; hideBar(); }, - // drag: function(e) - // { - // // scroll content - // scrollContent(0, $(this).position().top, false); - // } - // }); - // } // make it draggable and no longer dependent on the jqueryUI if (o.railDraggable){ bar.bind("mousedown", function(e) { var $doc = $(document); isDragg = true; t = parseFloat(bar.css('top')); - pageY = e.pageY; + pageY = e.pageY; $doc.bind("mousemove.slimscroll", function(e){ currTop = t + e.pageY - pageY; @@ -283,7 +268,7 @@ me.bind('touchmove', function(e){ // prevent scrolling the page if necessary - if(!releaseScroll) + if(!releaseScroll) { e.originalEvent.preventDefault(); } From 1b202263cc2f1c641e5f39bb47726126da456e3a Mon Sep 17 00:00:00 2001 From: "@rochal" Date: Sun, 18 Aug 2013 17:06:09 +1000 Subject: [PATCH 30/67] Add minified source --- jquery.slimscroll.min.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/jquery.slimscroll.min.js b/jquery.slimscroll.min.js index dd63f62..26220d6 100644 --- a/jquery.slimscroll.min.js +++ b/jquery.slimscroll.min.js @@ -2,14 +2,15 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.2.0 + * Version: 1.3.0 * */ -(function(e){jQuery.fn.extend({slimScroll:function(h){var a=e.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:0.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:0.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200},h);this.each(function(){function s(d){if(q){d=d||window.event;var c=0;d.wheelDelta&&(c=-d.wheelDelta/ -120);d.detail&&(c=d.detail/3);e(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&k(c,!0);d.preventDefault&&!m&&d.preventDefault();m||(d.returnValue=!1)}}function k(d,e,h){var f=d,g=b.outerHeight()-c.outerHeight();e&&(f=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),f=Math.min(Math.max(f,0),g),f=0=b.outerHeight()?m=!0:(c.stop(!0,!0).fadeIn("fast"),a.railVisible&&g.stop(!0,!0).fadeIn("fast"))}function n(){a.alwaysVisible||(x=setTimeout(function(){if((!a.disableFadeOut||!q)&&!v&&!w)c.fadeOut("slow"),g.fadeOut("slow")},1E3))}var q,v,w,x,z,r,j,y,B=30,m=!1,b=e(this);if(b.parent().hasClass(a.wrapperClass)){var l=b.scrollTop(),c=b.parent().find("."+a.barClass),g=b.parent().find("."+a.railClass);u();if(e.isPlainObject(h)){if("height"in -h&&"auto"==h.height){b.parent().css("height","auto");b.css("height","auto");var p=b.parent().parent().height();b.parent().css("height",p);b.css("height",p)}if("scrollTo"in h)l=parseInt(a.scrollTo);else if("scrollBy"in h)l+=parseInt(a.scrollBy);else if("destroy"in h){c.remove();g.remove();b.unwrap();return}k(l,!1,!0)}}else{a.height="auto"==a.height?b.parent().height():a.height;l=e("
    ").addClass(a.wrapperClass).css({position:"relative",overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden", -width:a.width,height:a.height});var g=e("
    ").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.size,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=e("
    ").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible?"block":"none","border-radius":a.size,BorderRadius:a.size,MozBorderRadius:a.size,WebkitBorderRadius:a.size, -zIndex:99}),p="right"==a.position?{right:a.distance}:{left:a.distance};g.css(p);c.css(p);b.wrap(l);b.parent().append(c);b.parent().append(g);a.railDraggable&&(e.ui&&"function"==typeof e.ui.draggable)&&c.draggable({axis:"y",containment:"parent",start:function(){w=!0},stop:function(){w=!1;n()},drag:function(){k(0,e(this).position().top,!1)}});g.hover(function(){t()},function(){n()});c.hover(function(){v=!0},function(){v=!1});b.hover(function(){q=!0;t();n()},function(){q=!1;n()});b.bind("touchstart", -function(a){a.originalEvent.touches.length&&(z=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){b.originalEvent.preventDefault();b.originalEvent.touches.length&&k((z-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0)});"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),k(0,!0)):"top"!==a.start&&(k(e(a.start).position().top,null,!0),a.alwaysVisible||c.hide());A();u()}});return this}});jQuery.fn.extend({slimscroll:jQuery.fn.slimScroll})})(jQuery); \ No newline at end of file +(function(f){jQuery.fn.extend({slimScroll:function(h){var a=f.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:0.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:0.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},h);this.each(function(){function r(d){if(s){d=d|| +window.event;var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);f(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&m(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function m(d,f,h){k=!1;var e=d,g=b.outerHeight()-c.outerHeight();f&&(e=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),e=Math.min(Math.max(e,0),g),e=0=b.outerHeight()?k=!0:(c.stop(!0,!0).fadeIn("fast"),a.railVisible&&g.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(A=setTimeout(function(){a.disableFadeOut&&s||(x||y)||(c.fadeOut("slow"),g.fadeOut("slow"))},1E3))}var s,x,y,A,z,u,l,B,D=30,k=!1,b=f(this);if(b.parent().hasClass(a.wrapperClass)){var n=b.scrollTop(), +c=b.parent().find("."+a.barClass),g=b.parent().find("."+a.railClass);w();if(f.isPlainObject(h)){if("height"in h&&"auto"==h.height){b.parent().css("height","auto");b.css("height","auto");var q=b.parent().parent().height();b.parent().css("height",q);b.css("height",q)}if("scrollTo"in h)n=parseInt(a.scrollTo);else if("scrollBy"in h)n+=parseInt(a.scrollBy);else if("destroy"in h){c.remove();g.remove();b.unwrap();return}m(n,!1,!0)}}else{a.height="auto"==a.height?b.parent().height():a.height;n=f("
    ").addClass(a.wrapperClass).css({position:"relative", +overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",width:a.width,height:a.height});var g=f("
    ").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=f("
    ").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible? +"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,WebkitBorderRadius:a.borderRadius,zIndex:99}),q="right"==a.position?{right:a.distance}:{left:a.distance};g.css(q);c.css(q);b.wrap(n);b.parent().append(c);b.parent().append(g);a.railDraggable&&c.bind("mousedown",function(a){var b=f(document);y=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);m(0,c.position().top,!1)}); +b.bind("mouseup.slimscroll",function(a){y=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",function(a){a.stopPropagation();a.preventDefault();return!1});g.hover(function(){v()},function(){p()});c.hover(function(){x=!0},function(){x=!1});b.hover(function(){s=!0;v();p()},function(){s=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(z=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&& +(m((z-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),z=b.originalEvent.touches[0].pageY)});w();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),m(0,!0)):"top"!==a.start&&(m(f(a.start).position().top,null,!0),a.alwaysVisible||c.hide());C()}});return this}});jQuery.fn.extend({slimscroll:jQuery.fn.slimScroll})})(jQuery); \ No newline at end of file From 9049771db559d8e89426df154aa1a065b00fc61b Mon Sep 17 00:00:00 2001 From: "@rochal" Date: Sun, 18 Aug 2013 17:20:44 +1000 Subject: [PATCH 31/67] Update version in package file. --- jquery.slimscroll.js | 2 +- jquery.slimscroll.min.js | 2 +- slimScroll.jquery.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 2ea5b08..0f07908 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -2,7 +2,7 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.3.0 + * Version: 1.3.1 * */ (function($) { diff --git a/jquery.slimscroll.min.js b/jquery.slimscroll.min.js index 26220d6..3071977 100644 --- a/jquery.slimscroll.min.js +++ b/jquery.slimscroll.min.js @@ -2,7 +2,7 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.3.0 + * Version: 1.3.1 * */ (function(f){jQuery.fn.extend({slimScroll:function(h){var a=f.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:0.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:0.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},h);this.each(function(){function r(d){if(s){d=d|| diff --git a/slimScroll.jquery.json b/slimScroll.jquery.json index 41174e6..1559a47 100644 --- a/slimScroll.jquery.json +++ b/slimScroll.jquery.json @@ -1,6 +1,6 @@ { "name" : "slimScroll", - "version" : "1.2.0", + "version" : "1.3.1", "title" : "jQuery slimScroll scrollbar", "description" : "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", "keywords" : ["scrollbar", "scroll", "slimscroll", "scrollable", "scrolling", "scroller", "ui"], From e7b34a43ea49e9c7fe1cd0f8ecfb32234a345539 Mon Sep 17 00:00:00 2001 From: sovanna Date: Tue, 3 Sep 2013 11:59:13 +0200 Subject: [PATCH 32/67] allow slimscroll to resize calling .slimscroll() again --- jquery.slimscroll.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 0f07908..bb9e053 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -115,6 +115,10 @@ var height = me.parent().parent().height(); me.parent().css('height', height); me.css('height', height); + } else if ('height' in options) { + var h = options.height; + me.parent().css('height', h); + me.css('height', h); } if ('scrollTo' in options) From 83bc441dafaecea12c173a2bbc28d15ef39c6b43 Mon Sep 17 00:00:00 2001 From: "@rochal" Date: Fri, 27 Dec 2013 17:52:06 +1100 Subject: [PATCH 33/67] Fixing issue #116 - incorrect height for multiple class selectors. --- examples/multiple-elements.html | 11 +++++++++-- jquery.slimscroll.js | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/examples/multiple-elements.html b/examples/multiple-elements.html index 6f98b32..8923825 100644 --- a/examples/multiple-elements.html +++ b/examples/multiple-elements.html @@ -14,6 +14,7 @@ Fork me on GitHub
    +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus, felis interdum condimentum consectetur, nisl libero elementum eros, vehicula congue lacus eros non diam. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus mauris lorem, lacinia id tempus non, imperdiet et leo. Cras sit amet erat sit amet lacus egestas placerat. Aenean ultricies ultrices mauris ac congue. In vel tortor vel velit tristique tempus ac id nisi. Proin quis lorem velit. Nunc dui dui, blandit a ullamcorper vitae, congue fringilla lectus. Aliquam ultricies malesuada feugiat. Vestibulum placerat turpis et eros lobortis vel semper sapien pulvinar.

    Pellentesque rhoncus aliquet porta. Sed vel magna eu turpis pharetra consequat ut vitae lectus. In molestie sollicitudin mi sit amet convallis. Aliquam erat volutpat. Nullam feugiat placerat ipsum eget malesuada. Nulla facilisis nunc non dolor vehicula pretium. Sed dui magna, sodales id pharetra non, ullamcorper eu sapien. Mauris ac consectetur leo. Mauris consequat, lectus ut bibendum pulvinar, leo magna feugiat enim, eu commodo lacus sem vel ante. Sed tempus metus eget leo mollis vulputate. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

    @@ -31,6 +32,8 @@

    Nulla rhoncus elementum convallis. Mauris condimentum aliquet egestas. Ut iaculis nisi eget tellus accumsan venenatis. Maecenas imperdiet aliquam porta. Aenean ultrices dolor sed quam laoreet varius. Curabitur condimentum blandit erat, quis accumsan eros interdum vitae. Curabitur ligula arcu, sollicitudin vitae iaculis sed, blandit sit amet enim. Morbi ullamcorper, metus vel mollis tristique, arcu turpis malesuada nisi, at dignissim lorem odio a orci. Proin ultrices, ipsum ut vestibulum interdum, libero felis auctor mi, vitae convallis nisl justo ac tellus. Integer nec lacinia turpis. Etiam massa nisl, rhoncus quis rutrum in, pretium eu leo. Proin a velit ut nulla laoreet vestibulum. Curabitur eu elit vitae felis auctor tincidunt. Curabitur tincidunt, metus sed sollicitudin cursus, quam elit commodo erat, ut tempor erat sapien vitae velit. Morbi nec viverra erat.

    Nullam scelerisque facilisis pretium. Vivamus lectus leo, commodo ac sagittis ac, dictum a mi. Donec quis massa ut libero malesuada commodo in et risus. Fusce nunc dolor, aliquet vel rutrum in, molestie sit amet massa. Aliquam suscipit, justo a commodo condimentum, enim sapien fringilla ante, sed lobortis orci lectus in ante. Donec vel interdum est. Donec placerat cursus lacus, eu ultricies nisl tincidunt a. Fusce libero risus, sagittis eleifend iaculis aliquet, condimentum vitae diam. Suspendisse potenti. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Proin leo purus, sodales a venenatis luctus, faucibus ac enim. Sed id metus ac sem lobortis pretium. Mauris faucibus tempor scelerisque. Nunc vulputate interdum tortor, non tincidunt dui condimentum eget. Aenean in porttitor velit. Nam accumsan rhoncus risus id consectetur.

    +
    +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus, felis interdum condimentum consectetur, nisl libero elementum eros, vehicula congue lacus eros non diam. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus mauris lorem, lacinia id tempus non, imperdiet et leo. Cras sit amet erat sit amet lacus egestas placerat. Aenean ultricies ultrices mauris ac congue. In vel tortor vel velit tristique tempus ac id nisi. Proin quis lorem velit. Nunc dui dui, blandit a ullamcorper vitae, congue fringilla lectus. Aliquam ultricies malesuada feugiat. Vestibulum placerat turpis et eros lobortis vel semper sapien pulvinar.

    Pellentesque rhoncus aliquet porta. Sed vel magna eu turpis pharetra consequat ut vitae lectus. In molestie sollicitudin mi sit amet convallis. Aliquam erat volutpat. Nullam feugiat placerat ipsum eget malesuada. Nulla facilisis nunc non dolor vehicula pretium. Sed dui magna, sodales id pharetra non, ullamcorper eu sapien. Mauris ac consectetur leo. Mauris consequat, lectus ut bibendum pulvinar, leo magna feugiat enim, eu commodo lacus sem vel ante. Sed tempus metus eget leo mollis vulputate. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

    @@ -48,6 +51,8 @@

    Nulla rhoncus elementum convallis. Mauris condimentum aliquet egestas. Ut iaculis nisi eget tellus accumsan venenatis. Maecenas imperdiet aliquam porta. Aenean ultrices dolor sed quam laoreet varius. Curabitur condimentum blandit erat, quis accumsan eros interdum vitae. Curabitur ligula arcu, sollicitudin vitae iaculis sed, blandit sit amet enim. Morbi ullamcorper, metus vel mollis tristique, arcu turpis malesuada nisi, at dignissim lorem odio a orci. Proin ultrices, ipsum ut vestibulum interdum, libero felis auctor mi, vitae convallis nisl justo ac tellus. Integer nec lacinia turpis. Etiam massa nisl, rhoncus quis rutrum in, pretium eu leo. Proin a velit ut nulla laoreet vestibulum. Curabitur eu elit vitae felis auctor tincidunt. Curabitur tincidunt, metus sed sollicitudin cursus, quam elit commodo erat, ut tempor erat sapien vitae velit. Morbi nec viverra erat.

    Nullam scelerisque facilisis pretium. Vivamus lectus leo, commodo ac sagittis ac, dictum a mi. Donec quis massa ut libero malesuada commodo in et risus. Fusce nunc dolor, aliquet vel rutrum in, molestie sit amet massa. Aliquam suscipit, justo a commodo condimentum, enim sapien fringilla ante, sed lobortis orci lectus in ante. Donec vel interdum est. Donec placerat cursus lacus, eu ultricies nisl tincidunt a. Fusce libero risus, sagittis eleifend iaculis aliquet, condimentum vitae diam. Suspendisse potenti. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Proin leo purus, sodales a venenatis luctus, faucibus ac enim. Sed id metus ac sem lobortis pretium. Mauris faucibus tempor scelerisque. Nunc vulputate interdum tortor, non tincidunt dui condimentum eget. Aenean in porttitor velit. Nam accumsan rhoncus risus id consectetur.

    +
    +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus, felis interdum condimentum consectetur, nisl libero elementum eros, vehicula congue lacus eros non diam. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus mauris lorem, lacinia id tempus non, imperdiet et leo. Cras sit amet erat sit amet lacus egestas placerat. Aenean ultricies ultrices mauris ac congue. In vel tortor vel velit tristique tempus ac id nisi. Proin quis lorem velit. Nunc dui dui, blandit a ullamcorper vitae, congue fringilla lectus. Aliquam ultricies malesuada feugiat. Vestibulum placerat turpis et eros lobortis vel semper sapien pulvinar.

    Pellentesque rhoncus aliquet porta. Sed vel magna eu turpis pharetra consequat ut vitae lectus. In molestie sollicitudin mi sit amet convallis. Aliquam erat volutpat. Nullam feugiat placerat ipsum eget malesuada. Nulla facilisis nunc non dolor vehicula pretium. Sed dui magna, sodales id pharetra non, ullamcorper eu sapien. Mauris ac consectetur leo. Mauris consequat, lectus ut bibendum pulvinar, leo magna feugiat enim, eu commodo lacus sem vel ante. Sed tempus metus eget leo mollis vulputate. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

    @@ -65,11 +70,12 @@

    Nulla rhoncus elementum convallis. Mauris condimentum aliquet egestas. Ut iaculis nisi eget tellus accumsan venenatis. Maecenas imperdiet aliquam porta. Aenean ultrices dolor sed quam laoreet varius. Curabitur condimentum blandit erat, quis accumsan eros interdum vitae. Curabitur ligula arcu, sollicitudin vitae iaculis sed, blandit sit amet enim. Morbi ullamcorper, metus vel mollis tristique, arcu turpis malesuada nisi, at dignissim lorem odio a orci. Proin ultrices, ipsum ut vestibulum interdum, libero felis auctor mi, vitae convallis nisl justo ac tellus. Integer nec lacinia turpis. Etiam massa nisl, rhoncus quis rutrum in, pretium eu leo. Proin a velit ut nulla laoreet vestibulum. Curabitur eu elit vitae felis auctor tincidunt. Curabitur tincidunt, metus sed sollicitudin cursus, quam elit commodo erat, ut tempor erat sapien vitae velit. Morbi nec viverra erat.

    Nullam scelerisque facilisis pretium. Vivamus lectus leo, commodo ac sagittis ac, dictum a mi. Donec quis massa ut libero malesuada commodo in et risus. Fusce nunc dolor, aliquet vel rutrum in, molestie sit amet massa. Aliquam suscipit, justo a commodo condimentum, enim sapien fringilla ante, sed lobortis orci lectus in ante. Donec vel interdum est. Donec placerat cursus lacus, eu ultricies nisl tincidunt a. Fusce libero risus, sagittis eleifend iaculis aliquet, condimentum vitae diam. Suspendisse potenti. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Proin leo purus, sodales a venenatis luctus, faucibus ac enim. Sed id metus ac sem lobortis pretium. Mauris faucibus tempor scelerisque. Nunc vulputate interdum tortor, non tincidunt dui condimentum eget. Aenean in porttitor velit. Nam accumsan rhoncus risus id consectetur.

    +
       $('.area').slimscroll({
    -    width: '200px'
    +    width: '200px',
       }).parent().css({
         'float': 'left',
         'margin-right': '30px'
    @@ -83,7 +89,8 @@
         $(function(){
     
           $('.area').slimscroll({
    -        width: '200px'
    +        width: '200px',
    +        height: 'auto'
           }).parent().css({
             'float': 'left',
             'margin-right': '30px'
    diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js
    index 0f07908..c8dc28e 100644
    --- a/jquery.slimscroll.js
    +++ b/jquery.slimscroll.js
    @@ -144,7 +144,7 @@
             }
     
             // optionally set height to the parent's height
    -        o.height = (o.height == 'auto') ? me.parent().height() : o.height;
    +        o.height = (options.height == 'auto') ? me.parent().height() : options.height;
     
             // wrap content
             var wrapper = $(divS)
    
    From 7236f8f4d74d6a7529128d9248d5045207fcabba Mon Sep 17 00:00:00 2001
    From: "@rochal" 
    Date: Fri, 27 Dec 2013 18:01:49 +1100
    Subject: [PATCH 34/67] Revert #65 to fix scrolling on Firefox - #95.
    
    ---
     jquery.slimscroll.js | 1 -
     1 file changed, 1 deletion(-)
    
    diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js
    index c8dc28e..9ec8294 100644
    --- a/jquery.slimscroll.js
    +++ b/jquery.slimscroll.js
    @@ -381,7 +381,6 @@
               {
                 this.addEventListener('DOMMouseScroll', _onWheel, false );
                 this.addEventListener('mousewheel', _onWheel, false );
    -            this.addEventListener('MozMousePixelScroll', _onWheel, false );
               }
               else
               {
    
    From e9a38f401068dcbd472e2efafaf0e69558f97c94 Mon Sep 17 00:00:00 2001
    From: "@rochal" 
    Date: Fri, 27 Dec 2013 18:03:13 +1100
    Subject: [PATCH 35/67] Up the version number.
    
    ---
     jquery.slimscroll.js     |  2 +-
     jquery.slimscroll.min.js | 18 +++++++++---------
     slimScroll.jquery.json   |  2 +-
     3 files changed, 11 insertions(+), 11 deletions(-)
    
    diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js
    index 9ec8294..8f813ee 100644
    --- a/jquery.slimscroll.js
    +++ b/jquery.slimscroll.js
    @@ -2,7 +2,7 @@
      * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
      * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
      *
    - * Version: 1.3.1
    + * Version: 1.3.2
      *
      */
     (function($) {
    diff --git a/jquery.slimscroll.min.js b/jquery.slimscroll.min.js
    index 3071977..40f9ce9 100644
    --- a/jquery.slimscroll.min.js
    +++ b/jquery.slimscroll.min.js
    @@ -2,15 +2,15 @@
      * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
      * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
      *
    - * Version: 1.3.1
    + * Version: 1.3.2
      *
      */
    -(function(f){jQuery.fn.extend({slimScroll:function(h){var a=f.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:0.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:0.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},h);this.each(function(){function r(d){if(s){d=d||
    -window.event;var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);f(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&m(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function m(d,f,h){k=!1;var e=d,g=b.outerHeight()-c.outerHeight();f&&(e=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),e=Math.min(Math.max(e,0),g),e=0=b.outerHeight()?k=!0:(c.stop(!0,!0).fadeIn("fast"),a.railVisible&&g.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(A=setTimeout(function(){a.disableFadeOut&&s||(x||y)||(c.fadeOut("slow"),g.fadeOut("slow"))},1E3))}var s,x,y,A,z,u,l,B,D=30,k=!1,b=f(this);if(b.parent().hasClass(a.wrapperClass)){var n=b.scrollTop(),
    -c=b.parent().find("."+a.barClass),g=b.parent().find("."+a.railClass);w();if(f.isPlainObject(h)){if("height"in h&&"auto"==h.height){b.parent().css("height","auto");b.css("height","auto");var q=b.parent().parent().height();b.parent().css("height",q);b.css("height",q)}if("scrollTo"in h)n=parseInt(a.scrollTo);else if("scrollBy"in h)n+=parseInt(a.scrollBy);else if("destroy"in h){c.remove();g.remove();b.unwrap();return}m(n,!1,!0)}}else{a.height="auto"==a.height?b.parent().height():a.height;n=f("
    ").addClass(a.wrapperClass).css({position:"relative", -overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",width:a.width,height:a.height});var g=f("
    ").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=f("
    ").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible? -"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,WebkitBorderRadius:a.borderRadius,zIndex:99}),q="right"==a.position?{right:a.distance}:{left:a.distance};g.css(q);c.css(q);b.wrap(n);b.parent().append(c);b.parent().append(g);a.railDraggable&&c.bind("mousedown",function(a){var b=f(document);y=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);m(0,c.position().top,!1)}); -b.bind("mouseup.slimscroll",function(a){y=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",function(a){a.stopPropagation();a.preventDefault();return!1});g.hover(function(){v()},function(){p()});c.hover(function(){x=!0},function(){x=!1});b.hover(function(){s=!0;v();p()},function(){s=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(z=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&& +(function(f){jQuery.fn.extend({slimScroll:function(g){var a=f.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:0.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:0.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},g);this.each(function(){function u(d){if(r){d=d|| +window.event;var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);f(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&m(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function m(d,f,g){k=!1;var e=d,h=b.outerHeight()-c.outerHeight();f&&(e=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),e=Math.min(Math.max(e,0),h),e=0=b.outerHeight()?k=!0:(c.stop(!0,!0).fadeIn("fast"),a.railVisible&&h.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(A=setTimeout(function(){a.disableFadeOut&&r||x||y||(c.fadeOut("slow"),h.fadeOut("slow"))},1E3))}var r,x,y,A,z,s,l,B,D=30,k=!1,b=f(this);if(b.parent().hasClass(a.wrapperClass)){var n=b.scrollTop(),c=b.parent().find("."+a.barClass),h=b.parent().find("."+ +a.railClass);w();if(f.isPlainObject(g)){if("height"in g&&"auto"==g.height){b.parent().css("height","auto");b.css("height","auto");var q=b.parent().parent().height();b.parent().css("height",q);b.css("height",q)}if("scrollTo"in g)n=parseInt(a.scrollTo);else if("scrollBy"in g)n+=parseInt(a.scrollBy);else if("destroy"in g){c.remove();h.remove();b.unwrap();return}m(n,!1,!0)}}else{a.height="auto"==g.height?b.parent().height():g.height;n=f("
    ").addClass(a.wrapperClass).css({position:"relative", +overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",width:a.width,height:a.height});var h=f("
    ").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=f("
    ").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible? +"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,WebkitBorderRadius:a.borderRadius,zIndex:99}),q="right"==a.position?{right:a.distance}:{left:a.distance};h.css(q);c.css(q);b.wrap(n);b.parent().append(c);b.parent().append(h);a.railDraggable&&c.bind("mousedown",function(a){var b=f(document);y=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);m(0,c.position().top,!1)}); +b.bind("mouseup.slimscroll",function(a){y=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",function(a){a.stopPropagation();a.preventDefault();return!1});h.hover(function(){v()},function(){p()});c.hover(function(){x=!0},function(){x=!1});b.hover(function(){r=!0;v();p()},function(){r=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(z=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&& (m((z-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),z=b.originalEvent.touches[0].pageY)});w();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),m(0,!0)):"top"!==a.start&&(m(f(a.start).position().top,null,!0),a.alwaysVisible||c.hide());C()}});return this}});jQuery.fn.extend({slimscroll:jQuery.fn.slimScroll})})(jQuery); \ No newline at end of file diff --git a/slimScroll.jquery.json b/slimScroll.jquery.json index 1559a47..9fd201b 100644 --- a/slimScroll.jquery.json +++ b/slimScroll.jquery.json @@ -1,6 +1,6 @@ { "name" : "slimScroll", - "version" : "1.3.1", + "version" : "1.3.2", "title" : "jQuery slimScroll scrollbar", "description" : "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", "keywords" : ["scrollbar", "scroll", "slimscroll", "scrollable", "scrolling", "scroller", "ui"], From be134d2e7c5be367d9750b3a903b1937a412c260 Mon Sep 17 00:00:00 2001 From: Joshua Balloch Date: Thu, 23 Jan 2014 11:52:59 +0800 Subject: [PATCH 36/67] dynamically assign isOverPanel to reduce mistaken mousewheel captures --- jquery.slimscroll.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 8f813ee..a957f1b 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -93,6 +93,11 @@ // used in event handlers and for better minification var me = $(this); + // create a simple function to check if panel is being hovered over. + isOverPanel = function () { + return me.is(":hover"); + } + // ensure we are not binding it again if (me.parent().hasClass(o.wrapperClass)) { @@ -249,11 +254,9 @@ // show on parent mouseover me.hover(function(){ - isOverPanel = true; showBar(); hideBar(); }, function(){ - isOverPanel = false; hideBar(); }); @@ -307,7 +310,7 @@ function _onWheel(e) { // use mouse wheel only when mouse is over - if (!isOverPanel) { return; } + if (!isOverPanel()) { return; } var e = e || window.event; @@ -440,7 +443,7 @@ if (!o.alwaysVisible) { queueHide = setTimeout(function(){ - if (!(o.disableFadeOut && isOverPanel) && !isOverBar && !isDragg) + if (!(o.disableFadeOut && isOverPanel()) && !isOverBar && !isDragg) { bar.fadeOut('slow'); rail.fadeOut('slow'); From 00a2dd7885ed2e3c897cc1662927babb62ab8864 Mon Sep 17 00:00:00 2001 From: Tony Wang Date: Sun, 4 May 2014 12:21:33 +0800 Subject: [PATCH 37/67] Create bower.json Make it to be friendly to bower --- bower.json | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 bower.json diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..9787b57 --- /dev/null +++ b/bower.json @@ -0,0 +1,30 @@ +{ + "name" : "slimScroll", + "version" : "1.3.2", + "title" : "jQuery slimScroll scrollbar", + "description" : "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", + "keywords" : ["scrollbar", "scroll", "slimscroll", "scrollable", "scrolling", "scroller", "ui"], + "demo" : "http://rocha.la/jQuery-slimScroll/", + "homepage" : "http://rocha.la/jQuery-slimScroll/", + "download" : "http://rocha.la/jQuery-slimScroll/", + + "author" : { + "name" : "Piotr Rochala", + "url" : "http://rocha.la/" + }, + + "dependencies" : { + "jquery" : ">= 1.7" + }, + + "licenses" : [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/mit-license.php" + }, + { + "type": "GPL", + "url": "http://www.opensource.org/licenses/gpl-license.php" + } + ] +} From 053e421191a786c515c8dd6dc7b9692e2efeee03 Mon Sep 17 00:00:00 2001 From: Tony Wang Date: Tue, 24 Jun 2014 09:53:08 +0800 Subject: [PATCH 38/67] Update bower.json add main attribute to the bower.json --- bower.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bower.json b/bower.json index 9787b57..52e0c8a 100644 --- a/bower.json +++ b/bower.json @@ -7,6 +7,8 @@ "demo" : "http://rocha.la/jQuery-slimScroll/", "homepage" : "http://rocha.la/jQuery-slimScroll/", "download" : "http://rocha.la/jQuery-slimScroll/", + + "main": "./jquery.slimscroll.min.js", "author" : { "name" : "Piotr Rochala", From 9bb3a79a963854960a971d605a41f25169aa5b07 Mon Sep 17 00:00:00 2001 From: Louy Alakkad Date: Mon, 30 Jun 2014 16:55:15 +0300 Subject: [PATCH 39/67] Calling "destroy" shouldn't create an instance Fixes #87 --- jquery.slimscroll.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 8f813ee..a4d195c 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -142,6 +142,13 @@ return; } + else if ($.isPlainObject(options)) + { + if ('destroy' in options) + { + return; + } + } // optionally set height to the parent's height o.height = (options.height == 'auto') ? me.parent().height() : options.height; From d41d7b764bcdd6aa2ff1676dd5c91a869ec6974d Mon Sep 17 00:00:00 2001 From: Keith Daulton Date: Fri, 11 Jul 2014 10:59:02 -0400 Subject: [PATCH 40/67] Use IIFE param for jQuery reference This is important if you assigned jQuery.noConflict() to variable and only want to reference that. --- jquery.slimscroll.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 8f813ee..82ff1f2 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -7,7 +7,7 @@ */ (function($) { - jQuery.fn.extend({ + $.fn.extend({ slimScroll: function(options) { var defaults = { @@ -456,8 +456,8 @@ } }); - jQuery.fn.extend({ - slimscroll: jQuery.fn.slimScroll + $.fn.extend({ + slimscroll: $.fn.slimScroll }); })(jQuery); From be03c37746fa0aea68cfec148fefa1c878d8386e Mon Sep 17 00:00:00 2001 From: Keith Daulton Date: Fri, 11 Jul 2014 11:02:23 -0400 Subject: [PATCH 41/67] Use IIFE param for jQuery reference Updated compressed version --- jquery.slimscroll.min.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/jquery.slimscroll.min.js b/jquery.slimscroll.min.js index 40f9ce9..c60cdbc 100644 --- a/jquery.slimscroll.min.js +++ b/jquery.slimscroll.min.js @@ -5,12 +5,4 @@ * Version: 1.3.2 * */ -(function(f){jQuery.fn.extend({slimScroll:function(g){var a=f.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:0.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:0.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},g);this.each(function(){function u(d){if(r){d=d|| -window.event;var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);f(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&m(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function m(d,f,g){k=!1;var e=d,h=b.outerHeight()-c.outerHeight();f&&(e=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),e=Math.min(Math.max(e,0),h),e=0=b.outerHeight()?k=!0:(c.stop(!0,!0).fadeIn("fast"),a.railVisible&&h.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(A=setTimeout(function(){a.disableFadeOut&&r||x||y||(c.fadeOut("slow"),h.fadeOut("slow"))},1E3))}var r,x,y,A,z,s,l,B,D=30,k=!1,b=f(this);if(b.parent().hasClass(a.wrapperClass)){var n=b.scrollTop(),c=b.parent().find("."+a.barClass),h=b.parent().find("."+ -a.railClass);w();if(f.isPlainObject(g)){if("height"in g&&"auto"==g.height){b.parent().css("height","auto");b.css("height","auto");var q=b.parent().parent().height();b.parent().css("height",q);b.css("height",q)}if("scrollTo"in g)n=parseInt(a.scrollTo);else if("scrollBy"in g)n+=parseInt(a.scrollBy);else if("destroy"in g){c.remove();h.remove();b.unwrap();return}m(n,!1,!0)}}else{a.height="auto"==g.height?b.parent().height():g.height;n=f("
    ").addClass(a.wrapperClass).css({position:"relative", -overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",width:a.width,height:a.height});var h=f("
    ").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=f("
    ").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible? -"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,WebkitBorderRadius:a.borderRadius,zIndex:99}),q="right"==a.position?{right:a.distance}:{left:a.distance};h.css(q);c.css(q);b.wrap(n);b.parent().append(c);b.parent().append(h);a.railDraggable&&c.bind("mousedown",function(a){var b=f(document);y=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);m(0,c.position().top,!1)}); -b.bind("mouseup.slimscroll",function(a){y=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",function(a){a.stopPropagation();a.preventDefault();return!1});h.hover(function(){v()},function(){p()});c.hover(function(){x=!0},function(){x=!1});b.hover(function(){r=!0;v();p()},function(){r=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(z=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&& -(m((z-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),z=b.originalEvent.touches[0].pageY)});w();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),m(0,!0)):"top"!==a.start&&(m(f(a.start).position().top,null,!0),a.alwaysVisible||c.hide());C()}});return this}});jQuery.fn.extend({slimscroll:jQuery.fn.slimScroll})})(jQuery); \ No newline at end of file +function(a){a.fn.extend({slimScroll:function(b){var c={width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},d=a.extend(c,b);return this.each(function(){function w(b){if(c){var b=b||window.event,e=0;b.wheelDelta&&(e=-b.wheelDelta/120),b.detail&&(e=b.detail/3);var f=b.target||b.srcTarget||b.srcElement;a(f).closest("."+d.wrapperClass).is(o.parent())&&x(e,!0),b.preventDefault&&!n&&b.preventDefault(),n||(b.returnValue=!1)}}function x(a,b,c){n=!1;var e=a,f=o.outerHeight()-u.outerHeight();if(b&&(e=parseInt(u.css("top"))+a*parseInt(d.wheelStep)/100*u.outerHeight(),e=Math.min(Math.max(e,0),f),e=a>0?Math.ceil(e):Math.floor(e),u.css({top:e+"px"})),j=parseInt(u.css("top"))/(o.outerHeight()-u.outerHeight()),e=j*(o[0].scrollHeight-o.outerHeight()),c){e=a;var g=e/o[0].scrollHeight*o.outerHeight();g=Math.min(Math.max(g,0),f),u.css({top:g+"px"})}o.scrollTop(e),o.trigger("slimscrolling",~~e),A(),B()}function y(){window.addEventListener?(this.addEventListener("DOMMouseScroll",w,!1),this.addEventListener("mousewheel",w,!1)):document.attachEvent("onmousewheel",w)}function z(){i=Math.max(o.outerHeight()/o[0].scrollHeight*o.outerHeight(),m),u.css({height:i+"px"});var a=i==o.outerHeight()?"none":"block";u.css({display:a})}function A(){if(z(),clearTimeout(g),j==~~j){if(n=d.allowPageScroll,k!=j){var a=0==~~j?"top":"bottom";o.trigger("slimscroll",a)}}else n=!1;return k=j,i>=o.outerHeight()?(n=!0,void 0):(u.stop(!0,!0).fadeIn("fast"),d.railVisible&&s.stop(!0,!0).fadeIn("fast"),void 0)}function B(){d.alwaysVisible||(g=setTimeout(function(){d.disableFadeOut&&c||e||f||(u.fadeOut("slow"),s.fadeOut("slow"))},1e3))}var c,e,f,g,h,i,j,k,l="
    ",m=30,n=!1,o=a(this);if(o.parent().hasClass(d.wrapperClass)){var p=o.scrollTop();if(u=o.parent().find("."+d.barClass),s=o.parent().find("."+d.railClass),z(),a.isPlainObject(b)){if("height"in b&&"auto"==b.height){o.parent().css("height","auto"),o.css("height","auto");var q=o.parent().parent().height();o.parent().css("height",q),o.css("height",q)}if("scrollTo"in b)p=parseInt(d.scrollTo);else if("scrollBy"in b)p+=parseInt(d.scrollBy);else if("destroy"in b)return u.remove(),s.remove(),o.unwrap(),void 0;x(p,!1,!0)}}else{d.height="auto"==b.height?o.parent().height():b.height;var r=a(l).addClass(d.wrapperClass).css({position:"relative",overflow:"hidden",width:d.width,height:d.height});o.css({overflow:"hidden",width:d.width,height:d.height});var s=a(l).addClass(d.railClass).css({width:d.size,height:"100%",position:"absolute",top:0,display:d.alwaysVisible&&d.railVisible?"block":"none","border-radius":d.railBorderRadius,background:d.railColor,opacity:d.railOpacity,zIndex:90}),u=a(l).addClass(d.barClass).css({background:d.color,width:d.size,position:"absolute",top:0,opacity:d.opacity,display:d.alwaysVisible?"block":"none","border-radius":d.borderRadius,BorderRadius:d.borderRadius,MozBorderRadius:d.borderRadius,WebkitBorderRadius:d.borderRadius,zIndex:99}),v="right"==d.position?{right:d.distance}:{left:d.distance};s.css(v),u.css(v),o.wrap(r),o.parent().append(u),o.parent().append(s),d.railDraggable&&u.bind("mousedown",function(b){var c=a(document);return f=!0,t=parseFloat(u.css("top")),pageY=b.pageY,c.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY,u.css("top",currTop),x(0,u.position().top,!1)}),c.bind("mouseup.slimscroll",function(){f=!1,B(),c.unbind(".slimscroll")}),!1}).bind("selectstart.slimscroll",function(a){return a.stopPropagation(),a.preventDefault(),!1}),s.hover(function(){A()},function(){B()}),u.hover(function(){e=!0},function(){e=!1}),o.hover(function(){c=!0,A(),B()},function(){c=!1,B()}),o.bind("touchstart",function(a){a.originalEvent.touches.length&&(h=a.originalEvent.touches[0].pageY)}),o.bind("touchmove",function(a){if(n||a.originalEvent.preventDefault(),a.originalEvent.touches.length){var b=(h-a.originalEvent.touches[0].pageY)/d.touchScrollStep;x(b,!0),h=a.originalEvent.touches[0].pageY}}),z(),"bottom"===d.start?(u.css({top:o.outerHeight()-u.outerHeight()}),x(0,!0)):"top"!==d.start&&(x(a(d.start).position().top,null,!0),d.alwaysVisible||u.hide()),y()}}),this}}),a.fn.extend({slimscroll:a.fn.slimScroll})}(jQuery); From f82fa180b0e3c5fd4ec05a038a541cfcf0d465b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20S=C3=A1nchez?= Date: Thu, 31 Jul 2014 08:51:56 -0430 Subject: [PATCH 42/67] a minor fix --- examples/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/style.css b/examples/style.css index f12104a..b676c81 100644 --- a/examples/style.css +++ b/examples/style.css @@ -6,7 +6,7 @@ pre.prettyprint { padding:15px; border:1px solid #eee; border-radius:5px; backgr .examples { border-radius:20px; background:#fff; padding:15px; margin:0 150px 0 0; border-collapse: collapse; border:1px solid #000; } .slimScrollDiv { border:1px solid #eee; } -#nav { position:fixed; top:0 left:0; background:#fff; padding:15px; border-radius:20px; width:200px; } +#nav { position:fixed; top:0; left:0; background:#fff; padding:15px; border-radius:20px; width:200px; } #nav ul { list-style-type:square; list-style-position:inside; margin:20px 0 0 0; padding:0; } #nav a { text-decoration:none; color:#000; } #nav a:hover { text-decoration: underline } From dd253675ee1de2646101ce14788d50c4510b580a Mon Sep 17 00:00:00 2001 From: piotrr Date: Mon, 1 Sep 2014 10:03:58 +1000 Subject: [PATCH 43/67] Fix issue with passing auto height option --- jquery.slimscroll.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 169c2b6..4d759ad 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -151,7 +151,7 @@ } // optionally set height to the parent's height - o.height = (options.height == 'auto') ? me.parent().height() : options.height; + o.height = (o.height == 'auto') ? me.parent().height() : o.height; // wrap content var wrapper = $(divS) From 4192bd561bb9bf65e32bb0fea95047e78166abb6 Mon Sep 17 00:00:00 2001 From: Piotr Rochala Date: Mon, 1 Sep 2014 10:14:10 +1000 Subject: [PATCH 44/67] Revert "[Critical Bug] dynamically assign isOverPanel to reduce mistaken mousewheel captures" --- jquery.slimscroll.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index d219493..4d759ad 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -93,11 +93,6 @@ // used in event handlers and for better minification var me = $(this); - // create a simple function to check if panel is being hovered over. - isOverPanel = function () { - return me.is(":hover"); - } - // ensure we are not binding it again if (me.parent().hasClass(o.wrapperClass)) { @@ -261,9 +256,11 @@ // show on parent mouseover me.hover(function(){ + isOverPanel = true; showBar(); hideBar(); }, function(){ + isOverPanel = false; hideBar(); }); @@ -317,7 +314,7 @@ function _onWheel(e) { // use mouse wheel only when mouse is over - if (!isOverPanel()) { return; } + if (!isOverPanel) { return; } var e = e || window.event; @@ -450,7 +447,7 @@ if (!o.alwaysVisible) { queueHide = setTimeout(function(){ - if (!(o.disableFadeOut && isOverPanel()) && !isOverBar && !isDragg) + if (!(o.disableFadeOut && isOverPanel) && !isOverBar && !isDragg) { bar.fadeOut('slow'); rail.fadeOut('slow'); From c1d1c794f8364d751b188c8b21859501c7991249 Mon Sep 17 00:00:00 2001 From: piotrr Date: Mon, 1 Sep 2014 10:17:54 +1000 Subject: [PATCH 45/67] Update version, recompile minified code --- bower.json | 4 ++-- jquery.slimscroll.js | 2 +- jquery.slimscroll.min.js | 12 ++++++++++-- slimScroll.jquery.json | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/bower.json b/bower.json index 52e0c8a..1f5f71f 100644 --- a/bower.json +++ b/bower.json @@ -1,13 +1,13 @@ { "name" : "slimScroll", - "version" : "1.3.2", + "version" : "1.3.3", "title" : "jQuery slimScroll scrollbar", "description" : "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", "keywords" : ["scrollbar", "scroll", "slimscroll", "scrollable", "scrolling", "scroller", "ui"], "demo" : "http://rocha.la/jQuery-slimScroll/", "homepage" : "http://rocha.la/jQuery-slimScroll/", "download" : "http://rocha.la/jQuery-slimScroll/", - + "main": "./jquery.slimscroll.min.js", "author" : { diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 4d759ad..190368e 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -2,7 +2,7 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.3.2 + * Version: 1.3.3 * */ (function($) { diff --git a/jquery.slimscroll.min.js b/jquery.slimscroll.min.js index c60cdbc..f25b5cc 100644 --- a/jquery.slimscroll.min.js +++ b/jquery.slimscroll.min.js @@ -2,7 +2,15 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.3.2 + * Version: 1.3.3 * */ -function(a){a.fn.extend({slimScroll:function(b){var c={width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},d=a.extend(c,b);return this.each(function(){function w(b){if(c){var b=b||window.event,e=0;b.wheelDelta&&(e=-b.wheelDelta/120),b.detail&&(e=b.detail/3);var f=b.target||b.srcTarget||b.srcElement;a(f).closest("."+d.wrapperClass).is(o.parent())&&x(e,!0),b.preventDefault&&!n&&b.preventDefault(),n||(b.returnValue=!1)}}function x(a,b,c){n=!1;var e=a,f=o.outerHeight()-u.outerHeight();if(b&&(e=parseInt(u.css("top"))+a*parseInt(d.wheelStep)/100*u.outerHeight(),e=Math.min(Math.max(e,0),f),e=a>0?Math.ceil(e):Math.floor(e),u.css({top:e+"px"})),j=parseInt(u.css("top"))/(o.outerHeight()-u.outerHeight()),e=j*(o[0].scrollHeight-o.outerHeight()),c){e=a;var g=e/o[0].scrollHeight*o.outerHeight();g=Math.min(Math.max(g,0),f),u.css({top:g+"px"})}o.scrollTop(e),o.trigger("slimscrolling",~~e),A(),B()}function y(){window.addEventListener?(this.addEventListener("DOMMouseScroll",w,!1),this.addEventListener("mousewheel",w,!1)):document.attachEvent("onmousewheel",w)}function z(){i=Math.max(o.outerHeight()/o[0].scrollHeight*o.outerHeight(),m),u.css({height:i+"px"});var a=i==o.outerHeight()?"none":"block";u.css({display:a})}function A(){if(z(),clearTimeout(g),j==~~j){if(n=d.allowPageScroll,k!=j){var a=0==~~j?"top":"bottom";o.trigger("slimscroll",a)}}else n=!1;return k=j,i>=o.outerHeight()?(n=!0,void 0):(u.stop(!0,!0).fadeIn("fast"),d.railVisible&&s.stop(!0,!0).fadeIn("fast"),void 0)}function B(){d.alwaysVisible||(g=setTimeout(function(){d.disableFadeOut&&c||e||f||(u.fadeOut("slow"),s.fadeOut("slow"))},1e3))}var c,e,f,g,h,i,j,k,l="
    ",m=30,n=!1,o=a(this);if(o.parent().hasClass(d.wrapperClass)){var p=o.scrollTop();if(u=o.parent().find("."+d.barClass),s=o.parent().find("."+d.railClass),z(),a.isPlainObject(b)){if("height"in b&&"auto"==b.height){o.parent().css("height","auto"),o.css("height","auto");var q=o.parent().parent().height();o.parent().css("height",q),o.css("height",q)}if("scrollTo"in b)p=parseInt(d.scrollTo);else if("scrollBy"in b)p+=parseInt(d.scrollBy);else if("destroy"in b)return u.remove(),s.remove(),o.unwrap(),void 0;x(p,!1,!0)}}else{d.height="auto"==b.height?o.parent().height():b.height;var r=a(l).addClass(d.wrapperClass).css({position:"relative",overflow:"hidden",width:d.width,height:d.height});o.css({overflow:"hidden",width:d.width,height:d.height});var s=a(l).addClass(d.railClass).css({width:d.size,height:"100%",position:"absolute",top:0,display:d.alwaysVisible&&d.railVisible?"block":"none","border-radius":d.railBorderRadius,background:d.railColor,opacity:d.railOpacity,zIndex:90}),u=a(l).addClass(d.barClass).css({background:d.color,width:d.size,position:"absolute",top:0,opacity:d.opacity,display:d.alwaysVisible?"block":"none","border-radius":d.borderRadius,BorderRadius:d.borderRadius,MozBorderRadius:d.borderRadius,WebkitBorderRadius:d.borderRadius,zIndex:99}),v="right"==d.position?{right:d.distance}:{left:d.distance};s.css(v),u.css(v),o.wrap(r),o.parent().append(u),o.parent().append(s),d.railDraggable&&u.bind("mousedown",function(b){var c=a(document);return f=!0,t=parseFloat(u.css("top")),pageY=b.pageY,c.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY,u.css("top",currTop),x(0,u.position().top,!1)}),c.bind("mouseup.slimscroll",function(){f=!1,B(),c.unbind(".slimscroll")}),!1}).bind("selectstart.slimscroll",function(a){return a.stopPropagation(),a.preventDefault(),!1}),s.hover(function(){A()},function(){B()}),u.hover(function(){e=!0},function(){e=!1}),o.hover(function(){c=!0,A(),B()},function(){c=!1,B()}),o.bind("touchstart",function(a){a.originalEvent.touches.length&&(h=a.originalEvent.touches[0].pageY)}),o.bind("touchmove",function(a){if(n||a.originalEvent.preventDefault(),a.originalEvent.touches.length){var b=(h-a.originalEvent.touches[0].pageY)/d.touchScrollStep;x(b,!0),h=a.originalEvent.touches[0].pageY}}),z(),"bottom"===d.start?(u.css({top:o.outerHeight()-u.outerHeight()}),x(0,!0)):"top"!==d.start&&(x(a(d.start).position().top,null,!0),d.alwaysVisible||u.hide()),y()}}),this}}),a.fn.extend({slimscroll:a.fn.slimScroll})}(jQuery); +(function(e){e.fn.extend({slimScroll:function(g){var a=e.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},g);this.each(function(){function u(d){if(r){d=d||window.event; +var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);e(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&m(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function m(d,e,g){k=!1;var f=d,h=b.outerHeight()-c.outerHeight();e&&(f=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),f=Math.min(Math.max(f,0),h),f=0=b.outerHeight()?k=!0:(c.stop(!0,!0).fadeIn("fast"),a.railVisible&&h.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(A=setTimeout(function(){a.disableFadeOut&&r||x||y||(c.fadeOut("slow"),h.fadeOut("slow"))},1E3))}var r,x,y,A,z,s,l,B,k=!1,b=e(this);if(b.parent().hasClass(a.wrapperClass)){var n=b.scrollTop(),c=b.parent().find("."+a.barClass),h=b.parent().find("."+a.railClass); +w();if(e.isPlainObject(g)){if("height"in g&&"auto"==g.height){b.parent().css("height","auto");b.css("height","auto");var q=b.parent().parent().height();b.parent().css("height",q);b.css("height",q)}if("scrollTo"in g)n=parseInt(a.scrollTo);else if("scrollBy"in g)n+=parseInt(a.scrollBy);else if("destroy"in g){c.remove();h.remove();b.unwrap();return}m(n,!1,!0)}}else if(!(e.isPlainObject(g)&&"destroy"in g)){a.height="auto"==a.height?b.parent().height():a.height;n=e("
    ").addClass(a.wrapperClass).css({position:"relative", +overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",width:a.width,height:a.height});var h=e("
    ").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=e("
    ").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible? +"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,WebkitBorderRadius:a.borderRadius,zIndex:99}),q="right"==a.position?{right:a.distance}:{left:a.distance};h.css(q);c.css(q);b.wrap(n);b.parent().append(c);b.parent().append(h);a.railDraggable&&c.bind("mousedown",function(a){var b=e(document);y=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);m(0,c.position().top,!1)}); +b.bind("mouseup.slimscroll",function(a){y=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",function(a){a.stopPropagation();a.preventDefault();return!1});h.hover(function(){v()},function(){p()});c.hover(function(){x=!0},function(){x=!1});b.hover(function(){r=!0;v();p()},function(){r=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(z=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&& +(m((z-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),z=b.originalEvent.touches[0].pageY)});w();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),m(0,!0)):"top"!==a.start&&(m(e(a.start).position().top,null,!0),a.alwaysVisible||c.hide());C()}});return this}});e.fn.extend({slimscroll:e.fn.slimScroll})})(jQuery); \ No newline at end of file diff --git a/slimScroll.jquery.json b/slimScroll.jquery.json index 9fd201b..a6bcd84 100644 --- a/slimScroll.jquery.json +++ b/slimScroll.jquery.json @@ -1,6 +1,6 @@ { "name" : "slimScroll", - "version" : "1.3.2", + "version" : "1.3.3", "title" : "jQuery slimScroll scrollbar", "description" : "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", "keywords" : ["scrollbar", "scroll", "slimscroll", "scrollable", "scrolling", "scroller", "ui"], From 2ffd91c78da6a82942a024c6e8727a80bded156c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marin=20B=C3=AEnzari?= Date: Sun, 15 Mar 2015 17:33:28 +0200 Subject: [PATCH 46/67] Allow multilevel slimscrolls Fixes issue #182: multilevel slimscrolls. Changed the selector to select the right `bar` and `rail` element to remove from DOM. In the issue https://github.com/rochal/jQuery-slimScroll/issues/182 is described that multilevel slimscrolls aren't allowed. On destroy of the parent slimscroll, the `bar`s and `rail`s DOM elements for the children scroll are removed. --- jquery.slimscroll.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 190368e..e3ac6e6 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -100,8 +100,8 @@ var offset = me.scrollTop(); // find bar and rail - bar = me.parent().find('.' + o.barClass); - rail = me.parent().find('.' + o.railClass); + bar = me.closest('.' + o.barClass); + rail = me.closest('.' + o.railClass); getBarHeight(); From 00c77d0543002089166cb4b800ecb99455c4e40a Mon Sep 17 00:00:00 2001 From: Tony Wang Date: Sat, 4 Apr 2015 11:06:56 +0800 Subject: [PATCH 47/67] Update jquery.slimscroll.js Inside the attach, this is the Window object, not the DOM container, this could cause the page scroll blocked, because the _onWheel still being used to process the page scroll event while the slimscroll container has been destroyed. --- jquery.slimscroll.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 190368e..a42947d 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -309,7 +309,7 @@ } // attach scroll events - attachWheel(); + attachWheel(this); function _onWheel(e) { @@ -382,12 +382,12 @@ hideBar(); } - function attachWheel() + function attachWheel(target) { if (window.addEventListener) { - this.addEventListener('DOMMouseScroll', _onWheel, false ); - this.addEventListener('mousewheel', _onWheel, false ); + target.addEventListener('DOMMouseScroll', _onWheel, false ); + target.addEventListener('mousewheel', _onWheel, false ); } else { From cc3014ba4f7a32a646c145b5b5e2634bafa712ab Mon Sep 17 00:00:00 2001 From: nirmal bhagwani Date: Thu, 16 Apr 2015 14:57:52 +0530 Subject: [PATCH 48/67] adding option if element is already hovered if element is already hovered like if you have applied slimscroll to whole body it will not fire scroll --- jquery.slimscroll.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 190368e..aacc9e2 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -48,6 +48,9 @@ // sets rail color railColor : '#333', + //if already mouse is there + mouseOver:false, + // sets rail opacity railOpacity : .2, @@ -333,6 +336,13 @@ if (!releaseScroll) { e.returnValue = false; } } + //if element is allready hovered + if(o.mouseOver){ + isOverPanel = true; + showBar(); + hideBar(); + } + function scrollContent(y, isWheel, isJump) { releaseScroll = false; From 15fe8209993c4610ef433997cc5b1928bf2ddc28 Mon Sep 17 00:00:00 2001 From: nirmal bhagwani Date: Thu, 16 Apr 2015 15:03:12 +0530 Subject: [PATCH 49/67] showing option of mouseover true demo --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 44d1b8f..7c86284 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,8 @@ Demo and more: http://rocha.la/jQuery-slimScroll Copyright (c) 2011 Piotr Rochala (http://rocha.la) Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. +added option over librarry of rochal +jQuery('#scroll').slimScroll({ + height: jQuery(window).height()+'px', //if you want whole page containing div to get scroll it's a trick only + mouseOver:true // if element you want to scroll will already hovered then make it true else no need to mention it. + }); From 1b0a211f0e2dd518a8bed5172f283c87da52c46f Mon Sep 17 00:00:00 2001 From: nirmal bhagwani Date: Sat, 18 Apr 2015 20:22:39 +0530 Subject: [PATCH 50/67] make it robust with animation and mouse pre over --- jquery.slimscroll.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index aacc9e2..381a4e8 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -50,6 +50,9 @@ //if already mouse is there mouseOver:false, + + // sets animation status on a given scroll + animate: false, // sets rail opacity railOpacity : .2, @@ -338,11 +341,16 @@ //if element is allready hovered if(o.mouseOver){ - isOverPanel = true; - showBar(); - hideBar(); + rail.trigger('hover') } + // scroll content + if (o.animate){ + me.animate({ scrollTop: delta }); + }else{ + me.scrollTop(delta); + } + function scrollContent(y, isWheel, isJump) { releaseScroll = false; From 75763c05e5c26a4bf3db5fc351e26045e897e34a Mon Sep 17 00:00:00 2001 From: nirmal bhagwani Date: Sat, 18 Apr 2015 20:23:39 +0530 Subject: [PATCH 51/67] update it with robust pre hover and adding animation option --- jquery.slimscroll.min.js | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/jquery.slimscroll.min.js b/jquery.slimscroll.min.js index f25b5cc..72d364f 100644 --- a/jquery.slimscroll.min.js +++ b/jquery.slimscroll.min.js @@ -1,16 +1 @@ -/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la) - * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) - * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. - * - * Version: 1.3.3 - * - */ -(function(e){e.fn.extend({slimScroll:function(g){var a=e.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},g);this.each(function(){function u(d){if(r){d=d||window.event; -var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);e(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&m(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function m(d,e,g){k=!1;var f=d,h=b.outerHeight()-c.outerHeight();e&&(f=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),f=Math.min(Math.max(f,0),h),f=0=b.outerHeight()?k=!0:(c.stop(!0,!0).fadeIn("fast"),a.railVisible&&h.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(A=setTimeout(function(){a.disableFadeOut&&r||x||y||(c.fadeOut("slow"),h.fadeOut("slow"))},1E3))}var r,x,y,A,z,s,l,B,k=!1,b=e(this);if(b.parent().hasClass(a.wrapperClass)){var n=b.scrollTop(),c=b.parent().find("."+a.barClass),h=b.parent().find("."+a.railClass); -w();if(e.isPlainObject(g)){if("height"in g&&"auto"==g.height){b.parent().css("height","auto");b.css("height","auto");var q=b.parent().parent().height();b.parent().css("height",q);b.css("height",q)}if("scrollTo"in g)n=parseInt(a.scrollTo);else if("scrollBy"in g)n+=parseInt(a.scrollBy);else if("destroy"in g){c.remove();h.remove();b.unwrap();return}m(n,!1,!0)}}else if(!(e.isPlainObject(g)&&"destroy"in g)){a.height="auto"==a.height?b.parent().height():a.height;n=e("
    ").addClass(a.wrapperClass).css({position:"relative", -overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",width:a.width,height:a.height});var h=e("
    ").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=e("
    ").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible? -"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,WebkitBorderRadius:a.borderRadius,zIndex:99}),q="right"==a.position?{right:a.distance}:{left:a.distance};h.css(q);c.css(q);b.wrap(n);b.parent().append(c);b.parent().append(h);a.railDraggable&&c.bind("mousedown",function(a){var b=e(document);y=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);m(0,c.position().top,!1)}); -b.bind("mouseup.slimscroll",function(a){y=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",function(a){a.stopPropagation();a.preventDefault();return!1});h.hover(function(){v()},function(){p()});c.hover(function(){x=!0},function(){x=!1});b.hover(function(){r=!0;v();p()},function(){r=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(z=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&& -(m((z-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),z=b.originalEvent.touches[0].pageY)});w();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),m(0,!0)):"top"!==a.start&&(m(e(a.start).position().top,null,!0),a.alwaysVisible||c.hide());C()}});return this}});e.fn.extend({slimscroll:e.fn.slimScroll})})(jQuery); \ No newline at end of file +!function(e){e.fn.extend({slimScroll:function(i){var o={width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",mouseOver:!1,animate:!1,railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},r=e.extend(o,i);return this.each(function(){function o(t){if(h){var t=t||window.event,i=0;t.wheelDelta&&(i=-t.wheelDelta/120),t.detail&&(i=t.detail/3);var o=t.target||t.srcTarget||t.srcElement;e(o).closest("."+r.wrapperClass).is(x.parent())&&a(i,!0),t.preventDefault&&!y&&t.preventDefault(),y||(t.returnValue=!1)}}function a(e,t,i){y=!1;var o=e,a=x.outerHeight()-O.outerHeight();if(t&&(o=parseInt(O.css("top"))+e*parseInt(r.wheelStep)/100*O.outerHeight(),o=Math.min(Math.max(o,0),a),o=e>0?Math.ceil(o):Math.floor(o),O.css({top:o+"px"})),v=parseInt(O.css("top"))/(x.outerHeight()-O.outerHeight()),o=v*(x[0].scrollHeight-x.outerHeight()),i){o=e;var s=o/x[0].scrollHeight*x.outerHeight();s=Math.min(Math.max(s,0),a),O.css({top:s+"px"})}x.scrollTop(o),x.trigger("slimscrolling",~~o),n(),c()}function s(){window.addEventListener?(this.addEventListener("DOMMouseScroll",o,!1),this.addEventListener("mousewheel",o,!1)):document.attachEvent("onmousewheel",o)}function l(){f=Math.max(x.outerHeight()/x[0].scrollHeight*x.outerHeight(),w),O.css({height:f+"px"});var e=f==x.outerHeight()?"none":"block";O.css({display:e})}function n(){if(l(),clearTimeout(p),v==~~v){if(y=r.allowPageScroll,b!=v){var e=0==~~v?"top":"bottom";x.trigger("slimscroll",e)}}else y=!1;return b=v,f>=x.outerHeight()?void(y=!0):(O.stop(!0,!0).fadeIn("fast"),void(r.railVisible&&E.stop(!0,!0).fadeIn("fast")))}function c(){r.alwaysVisible||(p=setTimeout(function(){r.disableFadeOut&&h||u||d||(O.fadeOut("slow"),E.fadeOut("slow"))},1e3))}var h,u,d,p,g,f,v,b,m="
    ",w=30,y=!1,x=e(this);if(x.parent().hasClass(r.wrapperClass)){var C=x.scrollTop();if(O=x.parent().find("."+r.barClass),E=x.parent().find("."+r.railClass),l(),e.isPlainObject(i)){if("height"in i&&"auto"==i.height){x.parent().css("height","auto"),x.css("height","auto");var H=x.parent().parent().height();x.parent().css("height",H),x.css("height",H)}if("scrollTo"in i)C=parseInt(r.scrollTo);else if("scrollBy"in i)C+=parseInt(r.scrollBy);else if("destroy"in i)return O.remove(),E.remove(),void x.unwrap();a(C,!1,!0)}}else if(!(e.isPlainObject(i)&&"destroy"in i)){r.height="auto"==r.height?x.parent().height():r.height;var S=e(m).addClass(r.wrapperClass).css({position:"relative",overflow:"hidden",width:r.width,height:r.height});x.css({overflow:"hidden",width:r.width,height:r.height});var E=e(m).addClass(r.railClass).css({width:r.size,height:"100%",position:"absolute",top:0,display:r.alwaysVisible&&r.railVisible?"block":"none","border-radius":r.railBorderRadius,background:r.railColor,opacity:r.railOpacity,zIndex:90}),O=e(m).addClass(r.barClass).css({background:r.color,width:r.size,position:"absolute",top:0,opacity:r.opacity,display:r.alwaysVisible?"block":"none","border-radius":r.borderRadius,BorderRadius:r.borderRadius,MozBorderRadius:r.borderRadius,WebkitBorderRadius:r.borderRadius,zIndex:99}),R="right"==r.position?{right:r.distance}:{left:r.distance};E.css(R),O.css(R),x.wrap(S),x.parent().append(O),x.parent().append(E),r.railDraggable&&O.bind("mousedown",function(i){var o=e(document);return d=!0,t=parseFloat(O.css("top")),pageY=i.pageY,o.bind("mousemove.slimscroll",function(e){currTop=t+e.pageY-pageY,O.css("top",currTop),a(0,O.position().top,!1)}),o.bind("mouseup.slimscroll",function(){d=!1,c(),o.unbind(".slimscroll")}),!1}).bind("selectstart.slimscroll",function(e){return e.stopPropagation(),e.preventDefault(),!1}),E.hover(function(){n()},function(){c()}),O.hover(function(){u=!0},function(){u=!1}),x.hover(function(){h=!0,n(),c()},function(){h=!1,c()}),x.bind("touchstart",function(e){e.originalEvent.touches.length&&(g=e.originalEvent.touches[0].pageY)}),x.bind("touchmove",function(e){if(y||e.originalEvent.preventDefault(),e.originalEvent.touches.length){var t=(g-e.originalEvent.touches[0].pageY)/r.touchScrollStep;a(t,!0),g=e.originalEvent.touches[0].pageY}}),l(),"bottom"===r.start?(O.css({top:x.outerHeight()-O.outerHeight()}),a(0,!0)):"top"!==r.start&&(a(e(r.start).position().top,null,!0),r.alwaysVisible||O.hide()),s(),r.mouseOver&&E.trigger("hover"),r.animate?x.animate({scrollTop:delta}):x.scrollTop(delta)}}),this}}),e.fn.extend({slimscroll:e.fn.slimScroll})}(jQuery); From 0364ad5467d556eff72a88c0d3908c13e1bf27cb Mon Sep 17 00:00:00 2001 From: Dotan Simha Date: Thu, 23 Apr 2015 18:20:21 +0300 Subject: [PATCH 52/67] Added support for Meteor.js packaging --- package.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 package.js diff --git a/package.js b/package.js new file mode 100644 index 0000000..b855202 --- /dev/null +++ b/package.js @@ -0,0 +1,13 @@ +Package.describe({ + name: 'rochal:slimscroll', + version: '1.3.3', + summary: 'jQuery SlimScroll package for meteor.', + git: 'https://github.com/rochal/jQuery-slimScroll', + documentation: 'README.md' +}); + +Package.onUse(function (api) { + api.versionsFrom('METEOR@0.9.0.1'); + api.use('jquery', 'client'); + api.addFiles('jquery.slimscroll.js', 'client'); +}); From 3956b86403d52824ce3bfd458f7589c6e1d720ff Mon Sep 17 00:00:00 2001 From: rochal Date: Sun, 7 Jun 2015 13:08:30 +1000 Subject: [PATCH 53/67] Fixup readme --- README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.md b/README.md index 7c86284..8042660 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,4 @@ slimScroll is a small jQuery plugin that transforms any div into a scrollable ar Demo and more: http://rocha.la/jQuery-slimScroll Copyright (c) 2011 Piotr Rochala (http://rocha.la) -Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. - -added option over librarry of rochal -jQuery('#scroll').slimScroll({ - height: jQuery(window).height()+'px', //if you want whole page containing div to get scroll it's a trick only - mouseOver:true // if element you want to scroll will already hovered then make it true else no need to mention it. - }); +Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. \ No newline at end of file From 3a3a51c42d2abb605b846e08813a8fce3470f470 Mon Sep 17 00:00:00 2001 From: rochal Date: Sun, 7 Jun 2015 13:13:25 +1000 Subject: [PATCH 54/67] Revert #199 --- jquery.slimscroll.js | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 381a4e8..190368e 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -48,12 +48,6 @@ // sets rail color railColor : '#333', - //if already mouse is there - mouseOver:false, - - // sets animation status on a given scroll - animate: false, - // sets rail opacity railOpacity : .2, @@ -339,18 +333,6 @@ if (!releaseScroll) { e.returnValue = false; } } - //if element is allready hovered - if(o.mouseOver){ - rail.trigger('hover') - } - - // scroll content - if (o.animate){ - me.animate({ scrollTop: delta }); - }else{ - me.scrollTop(delta); - } - function scrollContent(y, isWheel, isJump) { releaseScroll = false; From 43cb2d6c34cfdd0bf5735b385c077b585070bc7e Mon Sep 17 00:00:00 2001 From: rochal Date: Sun, 7 Jun 2015 14:04:32 +1000 Subject: [PATCH 55/67] Release 1.3.4 --- bower.json | 2 +- jquery.slimscroll.js | 2 +- jquery.slimscroll.min.js | 17 ++++++++++++++++- package.js | 2 +- slimScroll.jquery.json | 2 +- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/bower.json b/bower.json index 1f5f71f..06075f6 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name" : "slimScroll", - "version" : "1.3.3", + "version" : "1.3.4", "title" : "jQuery slimScroll scrollbar", "description" : "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", "keywords" : ["scrollbar", "scroll", "slimscroll", "scrollable", "scrolling", "scroller", "ui"], diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 3eeedb7..fad01f0 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -2,7 +2,7 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.3.3 + * Version: 1.3.4 * */ (function($) { diff --git a/jquery.slimscroll.min.js b/jquery.slimscroll.min.js index 72d364f..113c621 100644 --- a/jquery.slimscroll.min.js +++ b/jquery.slimscroll.min.js @@ -1 +1,16 @@ -!function(e){e.fn.extend({slimScroll:function(i){var o={width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",mouseOver:!1,animate:!1,railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},r=e.extend(o,i);return this.each(function(){function o(t){if(h){var t=t||window.event,i=0;t.wheelDelta&&(i=-t.wheelDelta/120),t.detail&&(i=t.detail/3);var o=t.target||t.srcTarget||t.srcElement;e(o).closest("."+r.wrapperClass).is(x.parent())&&a(i,!0),t.preventDefault&&!y&&t.preventDefault(),y||(t.returnValue=!1)}}function a(e,t,i){y=!1;var o=e,a=x.outerHeight()-O.outerHeight();if(t&&(o=parseInt(O.css("top"))+e*parseInt(r.wheelStep)/100*O.outerHeight(),o=Math.min(Math.max(o,0),a),o=e>0?Math.ceil(o):Math.floor(o),O.css({top:o+"px"})),v=parseInt(O.css("top"))/(x.outerHeight()-O.outerHeight()),o=v*(x[0].scrollHeight-x.outerHeight()),i){o=e;var s=o/x[0].scrollHeight*x.outerHeight();s=Math.min(Math.max(s,0),a),O.css({top:s+"px"})}x.scrollTop(o),x.trigger("slimscrolling",~~o),n(),c()}function s(){window.addEventListener?(this.addEventListener("DOMMouseScroll",o,!1),this.addEventListener("mousewheel",o,!1)):document.attachEvent("onmousewheel",o)}function l(){f=Math.max(x.outerHeight()/x[0].scrollHeight*x.outerHeight(),w),O.css({height:f+"px"});var e=f==x.outerHeight()?"none":"block";O.css({display:e})}function n(){if(l(),clearTimeout(p),v==~~v){if(y=r.allowPageScroll,b!=v){var e=0==~~v?"top":"bottom";x.trigger("slimscroll",e)}}else y=!1;return b=v,f>=x.outerHeight()?void(y=!0):(O.stop(!0,!0).fadeIn("fast"),void(r.railVisible&&E.stop(!0,!0).fadeIn("fast")))}function c(){r.alwaysVisible||(p=setTimeout(function(){r.disableFadeOut&&h||u||d||(O.fadeOut("slow"),E.fadeOut("slow"))},1e3))}var h,u,d,p,g,f,v,b,m="
    ",w=30,y=!1,x=e(this);if(x.parent().hasClass(r.wrapperClass)){var C=x.scrollTop();if(O=x.parent().find("."+r.barClass),E=x.parent().find("."+r.railClass),l(),e.isPlainObject(i)){if("height"in i&&"auto"==i.height){x.parent().css("height","auto"),x.css("height","auto");var H=x.parent().parent().height();x.parent().css("height",H),x.css("height",H)}if("scrollTo"in i)C=parseInt(r.scrollTo);else if("scrollBy"in i)C+=parseInt(r.scrollBy);else if("destroy"in i)return O.remove(),E.remove(),void x.unwrap();a(C,!1,!0)}}else if(!(e.isPlainObject(i)&&"destroy"in i)){r.height="auto"==r.height?x.parent().height():r.height;var S=e(m).addClass(r.wrapperClass).css({position:"relative",overflow:"hidden",width:r.width,height:r.height});x.css({overflow:"hidden",width:r.width,height:r.height});var E=e(m).addClass(r.railClass).css({width:r.size,height:"100%",position:"absolute",top:0,display:r.alwaysVisible&&r.railVisible?"block":"none","border-radius":r.railBorderRadius,background:r.railColor,opacity:r.railOpacity,zIndex:90}),O=e(m).addClass(r.barClass).css({background:r.color,width:r.size,position:"absolute",top:0,opacity:r.opacity,display:r.alwaysVisible?"block":"none","border-radius":r.borderRadius,BorderRadius:r.borderRadius,MozBorderRadius:r.borderRadius,WebkitBorderRadius:r.borderRadius,zIndex:99}),R="right"==r.position?{right:r.distance}:{left:r.distance};E.css(R),O.css(R),x.wrap(S),x.parent().append(O),x.parent().append(E),r.railDraggable&&O.bind("mousedown",function(i){var o=e(document);return d=!0,t=parseFloat(O.css("top")),pageY=i.pageY,o.bind("mousemove.slimscroll",function(e){currTop=t+e.pageY-pageY,O.css("top",currTop),a(0,O.position().top,!1)}),o.bind("mouseup.slimscroll",function(){d=!1,c(),o.unbind(".slimscroll")}),!1}).bind("selectstart.slimscroll",function(e){return e.stopPropagation(),e.preventDefault(),!1}),E.hover(function(){n()},function(){c()}),O.hover(function(){u=!0},function(){u=!1}),x.hover(function(){h=!0,n(),c()},function(){h=!1,c()}),x.bind("touchstart",function(e){e.originalEvent.touches.length&&(g=e.originalEvent.touches[0].pageY)}),x.bind("touchmove",function(e){if(y||e.originalEvent.preventDefault(),e.originalEvent.touches.length){var t=(g-e.originalEvent.touches[0].pageY)/r.touchScrollStep;a(t,!0),g=e.originalEvent.touches[0].pageY}}),l(),"bottom"===r.start?(O.css({top:x.outerHeight()-O.outerHeight()}),a(0,!0)):"top"!==r.start&&(a(e(r.start).position().top,null,!0),r.alwaysVisible||O.hide()),s(),r.mouseOver&&E.trigger("hover"),r.animate?x.animate({scrollTop:delta}):x.scrollTop(delta)}}),this}}),e.fn.extend({slimscroll:e.fn.slimScroll})}(jQuery); +/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la) + * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) + * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. + * + * Version: 1.3.4 + * + */ +(function(e){e.fn.extend({slimScroll:function(g){var a=e.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},g);this.each(function(){function v(d){if(r){d=d||window.event; +var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);e(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&m(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function m(d,e,g){k=!1;var f=d,h=b.outerHeight()-c.outerHeight();e&&(f=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),f=Math.min(Math.max(f,0),h),f=0=b.outerHeight()?k=!0:(c.stop(!0, +!0).fadeIn("fast"),a.railVisible&&h.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(B=setTimeout(function(){a.disableFadeOut&&r||y||z||(c.fadeOut("slow"),h.fadeOut("slow"))},1E3))}var r,y,z,B,A,u,l,C,k=!1,b=e(this);if(b.parent().hasClass(a.wrapperClass)){var n=b.scrollTop(),c=b.closest("."+a.barClass),h=b.closest("."+a.railClass);x();if(e.isPlainObject(g)){if("height"in g&&"auto"==g.height){b.parent().css("height","auto");b.css("height","auto");var q=b.parent().parent().height();b.parent().css("height", +q);b.css("height",q)}if("scrollTo"in g)n=parseInt(a.scrollTo);else if("scrollBy"in g)n+=parseInt(a.scrollBy);else if("destroy"in g){c.remove();h.remove();b.unwrap();return}m(n,!1,!0)}}else if(!(e.isPlainObject(g)&&"destroy"in g)){a.height="auto"==a.height?b.parent().height():a.height;n=e("
    ").addClass(a.wrapperClass).css({position:"relative",overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",width:a.width,height:a.height});var h=e("
    ").addClass(a.railClass).css({width:a.size, +height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=e("
    ").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible?"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,WebkitBorderRadius:a.borderRadius,zIndex:99}),q="right"==a.position? +{right:a.distance}:{left:a.distance};h.css(q);c.css(q);b.wrap(n);b.parent().append(c);b.parent().append(h);a.railDraggable&&c.bind("mousedown",function(a){var b=e(document);z=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);m(0,c.position().top,!1)});b.bind("mouseup.slimscroll",function(a){z=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",function(a){a.stopPropagation();a.preventDefault();return!1}); +h.hover(function(){w()},function(){p()});c.hover(function(){y=!0},function(){y=!1});b.hover(function(){r=!0;w();p()},function(){r=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(A=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&&(m((A-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),A=b.originalEvent.touches[0].pageY)});x();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}), +m(0,!0)):"top"!==a.start&&(m(e(a.start).position().top,null,!0),a.alwaysVisible||c.hide());window.addEventListener?(this.addEventListener("DOMMouseScroll",v,!1),this.addEventListener("mousewheel",v,!1)):document.attachEvent("onmousewheel",v)}});return this}});e.fn.extend({slimscroll:e.fn.slimScroll})})(jQuery); \ No newline at end of file diff --git a/package.js b/package.js index b855202..ab9b9e5 100644 --- a/package.js +++ b/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'rochal:slimscroll', - version: '1.3.3', + version: '1.3.4', summary: 'jQuery SlimScroll package for meteor.', git: 'https://github.com/rochal/jQuery-slimScroll', documentation: 'README.md' diff --git a/slimScroll.jquery.json b/slimScroll.jquery.json index a6bcd84..efbd1e1 100644 --- a/slimScroll.jquery.json +++ b/slimScroll.jquery.json @@ -1,6 +1,6 @@ { "name" : "slimScroll", - "version" : "1.3.3", + "version" : "1.3.4", "title" : "jQuery slimScroll scrollbar", "description" : "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", "keywords" : ["scrollbar", "scroll", "slimscroll", "scrollable", "scrolling", "scroller", "ui"], From 3f836a9be56b84ddffa1aa37bc61467d889a66f8 Mon Sep 17 00:00:00 2001 From: rochal Date: Sun, 7 Jun 2015 14:15:24 +1000 Subject: [PATCH 56/67] Bump up version --- bower.json | 2 +- jquery.slimscroll.js | 2 +- jquery.slimscroll.min.js | 2 +- package.js | 2 +- slimScroll.jquery.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bower.json b/bower.json index 06075f6..aead77a 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name" : "slimScroll", - "version" : "1.3.4", + "version" : "1.3.5", "title" : "jQuery slimScroll scrollbar", "description" : "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", "keywords" : ["scrollbar", "scroll", "slimscroll", "scrollable", "scrolling", "scroller", "ui"], diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index fad01f0..e49bad0 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -2,7 +2,7 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.3.4 + * Version: 1.3.5 * */ (function($) { diff --git a/jquery.slimscroll.min.js b/jquery.slimscroll.min.js index 113c621..2db66a3 100644 --- a/jquery.slimscroll.min.js +++ b/jquery.slimscroll.min.js @@ -2,7 +2,7 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.3.4 + * Version: 1.3.5 * */ (function(e){e.fn.extend({slimScroll:function(g){var a=e.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},g);this.each(function(){function v(d){if(r){d=d||window.event; diff --git a/package.js b/package.js index ab9b9e5..40fa567 100644 --- a/package.js +++ b/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'rochal:slimscroll', - version: '1.3.4', + version: '1.3.5', summary: 'jQuery SlimScroll package for meteor.', git: 'https://github.com/rochal/jQuery-slimScroll', documentation: 'README.md' diff --git a/slimScroll.jquery.json b/slimScroll.jquery.json index efbd1e1..1351791 100644 --- a/slimScroll.jquery.json +++ b/slimScroll.jquery.json @@ -1,6 +1,6 @@ { "name" : "slimScroll", - "version" : "1.3.4", + "version" : "1.3.5", "title" : "jQuery slimScroll scrollbar", "description" : "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", "keywords" : ["scrollbar", "scroll", "slimscroll", "scrollable", "scrolling", "scroller", "ui"], From 7d25f8901951185e65b5a7cd8a65e5c3c28338c0 Mon Sep 17 00:00:00 2001 From: rochal Date: Sun, 7 Jun 2015 14:34:35 +1000 Subject: [PATCH 57/67] Add npm package.json, bump up version --- bower.json | 2 +- jquery.slimscroll.js | 2 +- jquery.slimscroll.min.js | 2 +- package.js | 2 +- package.json | 31 +++++++++++++++++++++++++++++++ slimScroll.jquery.json | 4 ++-- 6 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 package.json diff --git a/bower.json b/bower.json index aead77a..5e64416 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name" : "slimScroll", - "version" : "1.3.5", + "version" : "1.3.6", "title" : "jQuery slimScroll scrollbar", "description" : "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", "keywords" : ["scrollbar", "scroll", "slimscroll", "scrollable", "scrolling", "scroller", "ui"], diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index e49bad0..2261a1b 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -2,7 +2,7 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.3.5 + * Version: 1.3.6 * */ (function($) { diff --git a/jquery.slimscroll.min.js b/jquery.slimscroll.min.js index 2db66a3..f41e608 100644 --- a/jquery.slimscroll.min.js +++ b/jquery.slimscroll.min.js @@ -2,7 +2,7 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.3.5 + * Version: 1.3.6 * */ (function(e){e.fn.extend({slimScroll:function(g){var a=e.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},g);this.each(function(){function v(d){if(r){d=d||window.event; diff --git a/package.js b/package.js index 40fa567..1aec1fb 100644 --- a/package.js +++ b/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'rochal:slimscroll', - version: '1.3.5', + version: '1.3.6', summary: 'jQuery SlimScroll package for meteor.', git: 'https://github.com/rochal/jQuery-slimScroll', documentation: 'README.md' diff --git a/package.json b/package.json new file mode 100644 index 0000000..3e67a4d --- /dev/null +++ b/package.json @@ -0,0 +1,31 @@ +{ + "name" : "slimScroll", + "version" : "1.3.6", + "title" : "jQuery slimScroll scrollbar", + "description" : "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", + "keywords" : ["scrollbar", "scroll", "slimscroll", "scrollable", "scrolling", "scroller", "ui", "jquery-plugin", "ecosystem:jquery"], + "homepage" : "http://rocha.la/jQuery-slimScroll/", + "repository": { + "type": "git", + "url": "https://github.com/rochal/jQuery-slimScroll.git" + }, + "author" : { + "name" : "Piotr Rochala", + "url" : "http://rocha.la/" + }, + + "dependencies" : { + "jquery" : ">= 1.7" + }, + + "licenses" : [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/mit-license.php" + }, + { + "type": "GPL", + "url": "http://www.opensource.org/licenses/gpl-license.php" + } + ] +} \ No newline at end of file diff --git a/slimScroll.jquery.json b/slimScroll.jquery.json index 1351791..0c08bad 100644 --- a/slimScroll.jquery.json +++ b/slimScroll.jquery.json @@ -1,9 +1,9 @@ { "name" : "slimScroll", - "version" : "1.3.5", + "version" : "1.3.6", "title" : "jQuery slimScroll scrollbar", "description" : "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", - "keywords" : ["scrollbar", "scroll", "slimscroll", "scrollable", "scrolling", "scroller", "ui"], + "keywords" : ["scrollbar", "scroll", "slimscroll", "scrollable", "scrolling", "scroller", "ui", "jquery-plugin", "ecosystem:jquery"], "demo" : "http://rocha.la/jQuery-slimScroll/", "homepage" : "http://rocha.la/jQuery-slimScroll/", "download" : "http://rocha.la/jQuery-slimScroll/", From e0704eb971e9b5adb2187979f8a92e9677874b81 Mon Sep 17 00:00:00 2001 From: rochal Date: Sun, 7 Jun 2015 14:36:37 +1000 Subject: [PATCH 58/67] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3e67a4d..8dd6c27 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name" : "slimScroll", + "name" : "jquery-slimscroll", "version" : "1.3.6", "title" : "jQuery slimScroll scrollbar", "description" : "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", From 52825188661dab1eb39c78f84a70ec2931b55d46 Mon Sep 17 00:00:00 2001 From: rochal Date: Sun, 7 Jun 2015 14:42:03 +1000 Subject: [PATCH 59/67] Update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8042660..bc90347 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ slimScroll is a small jQuery plugin that transforms any div into a scrollable area with a nice scrollbar - similar to the one Facebook and Google started using in their products recently. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over. User can drag the scrollbar or use mouse-wheel to change the scroll value. -Demo and more: http://rocha.la/jQuery-slimScroll +Demo and deocumentation available here: [jQuery slimScroll docs](http://rocha.la/jQuery-slimScroll) Copyright (c) 2011 Piotr Rochala (http://rocha.la) Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. \ No newline at end of file From d6309d6d18bc1c488df246bd92aef54a422563d2 Mon Sep 17 00:00:00 2001 From: laomao800-pe Date: Tue, 8 Sep 2015 17:16:52 +0800 Subject: [PATCH 60/67] fix "destroy" can't remove '.slimScrollRail' and '.slimScrollBar' --- jquery.slimscroll.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 2261a1b..170d5c4 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -100,8 +100,8 @@ var offset = me.scrollTop(); // find bar and rail - bar = me.closest('.' + o.barClass); - rail = me.closest('.' + o.railClass); + bar = me.siblings('.' + o.barClass); + rail = me.siblings('.' + o.railClass); getBarHeight(); From 119ad077e3b7a1c99abd9eac54304096a43324ae Mon Sep 17 00:00:00 2001 From: Piotr Rochala Date: Thu, 19 Nov 2015 20:47:16 +1100 Subject: [PATCH 61/67] Clear up package managers, this is getting ridicilous. npm ftw. --- bower.json | 32 -------------------------------- package.js | 13 ------------- slimScroll.jquery.json | 30 ------------------------------ 3 files changed, 75 deletions(-) delete mode 100644 bower.json delete mode 100644 package.js delete mode 100644 slimScroll.jquery.json diff --git a/bower.json b/bower.json deleted file mode 100644 index 5e64416..0000000 --- a/bower.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name" : "slimScroll", - "version" : "1.3.6", - "title" : "jQuery slimScroll scrollbar", - "description" : "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", - "keywords" : ["scrollbar", "scroll", "slimscroll", "scrollable", "scrolling", "scroller", "ui"], - "demo" : "http://rocha.la/jQuery-slimScroll/", - "homepage" : "http://rocha.la/jQuery-slimScroll/", - "download" : "http://rocha.la/jQuery-slimScroll/", - - "main": "./jquery.slimscroll.min.js", - - "author" : { - "name" : "Piotr Rochala", - "url" : "http://rocha.la/" - }, - - "dependencies" : { - "jquery" : ">= 1.7" - }, - - "licenses" : [ - { - "type": "MIT", - "url": "http://www.opensource.org/licenses/mit-license.php" - }, - { - "type": "GPL", - "url": "http://www.opensource.org/licenses/gpl-license.php" - } - ] -} diff --git a/package.js b/package.js deleted file mode 100644 index 1aec1fb..0000000 --- a/package.js +++ /dev/null @@ -1,13 +0,0 @@ -Package.describe({ - name: 'rochal:slimscroll', - version: '1.3.6', - summary: 'jQuery SlimScroll package for meteor.', - git: 'https://github.com/rochal/jQuery-slimScroll', - documentation: 'README.md' -}); - -Package.onUse(function (api) { - api.versionsFrom('METEOR@0.9.0.1'); - api.use('jquery', 'client'); - api.addFiles('jquery.slimscroll.js', 'client'); -}); diff --git a/slimScroll.jquery.json b/slimScroll.jquery.json deleted file mode 100644 index 0c08bad..0000000 --- a/slimScroll.jquery.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name" : "slimScroll", - "version" : "1.3.6", - "title" : "jQuery slimScroll scrollbar", - "description" : "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", - "keywords" : ["scrollbar", "scroll", "slimscroll", "scrollable", "scrolling", "scroller", "ui", "jquery-plugin", "ecosystem:jquery"], - "demo" : "http://rocha.la/jQuery-slimScroll/", - "homepage" : "http://rocha.la/jQuery-slimScroll/", - "download" : "http://rocha.la/jQuery-slimScroll/", - - "author" : { - "name" : "Piotr Rochala", - "url" : "http://rocha.la/" - }, - - "dependencies" : { - "jquery" : ">= 1.7" - }, - - "licenses" : [ - { - "type": "MIT", - "url": "http://www.opensource.org/licenses/mit-license.php" - }, - { - "type": "GPL", - "url": "http://www.opensource.org/licenses/gpl-license.php" - } - ] -} \ No newline at end of file From 00d27e3541d9cb4ada6f41b06cd67bef62d9d2b3 Mon Sep 17 00:00:00 2001 From: Piotr Rochala Date: Thu, 19 Nov 2015 20:47:23 +1100 Subject: [PATCH 62/67] Bump up version --- jquery.slimscroll.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index c793290..2b26ca0 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -2,7 +2,7 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.3.6 + * Version: 1.3.7 * */ (function($) { diff --git a/package.json b/package.json index 8dd6c27..4ac6ccf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name" : "jquery-slimscroll", - "version" : "1.3.6", + "version" : "1.3.7", "title" : "jQuery slimScroll scrollbar", "description" : "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", "keywords" : ["scrollbar", "scroll", "slimscroll", "scrollable", "scrolling", "scroller", "ui", "jquery-plugin", "ecosystem:jquery"], From f1e3eeb4c571e77a9abdfaa13186a43611c91025 Mon Sep 17 00:00:00 2001 From: Piotr Rochala Date: Thu, 19 Nov 2015 20:59:46 +1100 Subject: [PATCH 63/67] Update minified version. --- jquery.slimscroll.min.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/jquery.slimscroll.min.js b/jquery.slimscroll.min.js index f41e608..decf42f 100644 --- a/jquery.slimscroll.min.js +++ b/jquery.slimscroll.min.js @@ -2,15 +2,15 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.3.6 + * Version: 1.3.7 * */ -(function(e){e.fn.extend({slimScroll:function(g){var a=e.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},g);this.each(function(){function v(d){if(r){d=d||window.event; -var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);e(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&m(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function m(d,e,g){k=!1;var f=d,h=b.outerHeight()-c.outerHeight();e&&(f=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),f=Math.min(Math.max(f,0),h),f=0=b.outerHeight()?k=!0:(c.stop(!0, -!0).fadeIn("fast"),a.railVisible&&h.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(B=setTimeout(function(){a.disableFadeOut&&r||y||z||(c.fadeOut("slow"),h.fadeOut("slow"))},1E3))}var r,y,z,B,A,u,l,C,k=!1,b=e(this);if(b.parent().hasClass(a.wrapperClass)){var n=b.scrollTop(),c=b.closest("."+a.barClass),h=b.closest("."+a.railClass);x();if(e.isPlainObject(g)){if("height"in g&&"auto"==g.height){b.parent().css("height","auto");b.css("height","auto");var q=b.parent().parent().height();b.parent().css("height", -q);b.css("height",q)}if("scrollTo"in g)n=parseInt(a.scrollTo);else if("scrollBy"in g)n+=parseInt(a.scrollBy);else if("destroy"in g){c.remove();h.remove();b.unwrap();return}m(n,!1,!0)}}else if(!(e.isPlainObject(g)&&"destroy"in g)){a.height="auto"==a.height?b.parent().height():a.height;n=e("
    ").addClass(a.wrapperClass).css({position:"relative",overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",width:a.width,height:a.height});var h=e("
    ").addClass(a.railClass).css({width:a.size, -height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=e("
    ").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible?"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,WebkitBorderRadius:a.borderRadius,zIndex:99}),q="right"==a.position? -{right:a.distance}:{left:a.distance};h.css(q);c.css(q);b.wrap(n);b.parent().append(c);b.parent().append(h);a.railDraggable&&c.bind("mousedown",function(a){var b=e(document);z=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);m(0,c.position().top,!1)});b.bind("mouseup.slimscroll",function(a){z=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",function(a){a.stopPropagation();a.preventDefault();return!1}); -h.hover(function(){w()},function(){p()});c.hover(function(){y=!0},function(){y=!1});b.hover(function(){r=!0;w();p()},function(){r=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(A=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&&(m((A-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),A=b.originalEvent.touches[0].pageY)});x();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}), -m(0,!0)):"top"!==a.start&&(m(e(a.start).position().top,null,!0),a.alwaysVisible||c.hide());window.addEventListener?(this.addEventListener("DOMMouseScroll",v,!1),this.addEventListener("mousewheel",v,!1)):document.attachEvent("onmousewheel",v)}});return this}});e.fn.extend({slimscroll:e.fn.slimScroll})})(jQuery); \ No newline at end of file +(function(e){e.fn.extend({slimScroll:function(f){var a=e.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},f);this.each(function(){function v(d){if(r){d=d||window.event; +var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);e(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&n(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function n(d,e,f){k=!1;var g=d,h=b.outerHeight()-c.outerHeight();e&&(g=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),g=Math.min(Math.max(g,0),h),g=0=b.outerHeight()?k=!0:(c.stop(!0, +!0).fadeIn("fast"),a.railVisible&&m.stop(!0,!0).fadeIn("fast"))}function q(){a.alwaysVisible||(B=setTimeout(function(){a.disableFadeOut&&r||y||z||(c.fadeOut("slow"),m.fadeOut("slow"))},1E3))}var r,y,z,B,A,u,l,C,k=!1,b=e(this);if(b.parent().hasClass(a.wrapperClass)){var p=b.scrollTop(),c=b.siblings("."+a.barClass),m=b.siblings("."+a.railClass);x();if(e.isPlainObject(f)){if("height"in f&&"auto"==f.height){b.parent().css("height","auto");b.css("height","auto");var h=b.parent().parent().height();b.parent().css("height", +h);b.css("height",h)}else"height"in f&&(h=f.height,b.parent().css("height",h),b.css("height",h));if("scrollTo"in f)p=parseInt(a.scrollTo);else if("scrollBy"in f)p+=parseInt(a.scrollBy);else if("destroy"in f){c.remove();m.remove();b.unwrap();return}n(p,!1,!0)}}else if(!(e.isPlainObject(f)&&"destroy"in f)){a.height="auto"==a.height?b.parent().height():a.height;p=e("
    ").addClass(a.wrapperClass).css({position:"relative",overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden", +width:a.width,height:a.height});var m=e("
    ").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=e("
    ").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible?"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius, +WebkitBorderRadius:a.borderRadius,zIndex:99}),h="right"==a.position?{right:a.distance}:{left:a.distance};m.css(h);c.css(h);b.wrap(p);b.parent().append(c);b.parent().append(m);a.railDraggable&&c.bind("mousedown",function(a){var b=e(document);z=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);n(0,c.position().top,!1)});b.bind("mouseup.slimscroll",function(a){z=!1;q();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll", +function(a){a.stopPropagation();a.preventDefault();return!1});m.hover(function(){w()},function(){q()});c.hover(function(){y=!0},function(){y=!1});b.hover(function(){r=!0;w();q()},function(){r=!1;q()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(A=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&&(n((A-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),A=b.originalEvent.touches[0].pageY)}); +x();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),n(0,!0)):"top"!==a.start&&(n(e(a.start).position().top,null,!0),a.alwaysVisible||c.hide());window.addEventListener?(this.addEventListener("DOMMouseScroll",v,!1),this.addEventListener("mousewheel",v,!1)):document.attachEvent("onmousewheel",v)}});return this}});e.fn.extend({slimscroll:e.fn.slimScroll})})(jQuery); \ No newline at end of file From f730bc6433837ed8c5a15cf5fcb060644db367cd Mon Sep 17 00:00:00 2001 From: Claude Khedhiri Date: Wed, 25 Nov 2015 16:51:21 +0100 Subject: [PATCH 64/67] add bower.son bump up version --- .gitignore | 9 ++++++++ bower.json | 46 ++++++++++++++++++++++++++++++++++++++++ jquery.slimscroll.js | 2 +- jquery.slimscroll.min.js | 2 +- package.json | 2 +- 5 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 bower.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..208d3ce --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +### Node template +node_modules/ +npm-debug.log* + +### JetBrains template +*.iml +.idea/ +/out/ +.idea_modules/ \ No newline at end of file diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..831eb32 --- /dev/null +++ b/bower.json @@ -0,0 +1,46 @@ +{ + "name": "jquery-slimscroll", + "version": "1.3.8", + "description": "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", + "keywords": [ + "scrollbar", + "scroll", + "slimscroll", + "scrollable", + "scrolling", + "scroller", + "ui", + "jquery-plugin", + "ecosystem:jquery" + ], + "homepage": "http://rocha.la/jQuery-slimScroll/", + "authors": [ + { "name": "Piotr Rochala", "homepage": "http://rocha.la/" } + ], + "repository": { + "type": "git", + "url": "https://github.com/rochal/jQuery-slimScroll.git" + }, + "main": [ + "jquery.slimscroll.js", + "jquery.slimscroll.min.js" + ], + "licenses" : [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/mit-license.php" + }, + { + "type": "GPL", + "url": "http://www.opensource.org/licenses/gpl-license.php" + } + ], + "moduleType": [], + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 2b26ca0..90caed3 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -2,7 +2,7 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.3.7 + * Version: 1.3.8 * */ (function($) { diff --git a/jquery.slimscroll.min.js b/jquery.slimscroll.min.js index decf42f..2683487 100644 --- a/jquery.slimscroll.min.js +++ b/jquery.slimscroll.min.js @@ -2,7 +2,7 @@ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * - * Version: 1.3.7 + * Version: 1.3.8 * */ (function(e){e.fn.extend({slimScroll:function(f){var a=e.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},f);this.each(function(){function v(d){if(r){d=d||window.event; diff --git a/package.json b/package.json index 4ac6ccf..4005577 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name" : "jquery-slimscroll", - "version" : "1.3.7", + "version" : "1.3.8", "title" : "jQuery slimScroll scrollbar", "description" : "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", "keywords" : ["scrollbar", "scroll", "slimscroll", "scrollable", "scrolling", "scroller", "ui", "jquery-plugin", "ecosystem:jquery"], From d5b86d40e424fb00a523ea6509aa73db625eb0d4 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bidegain Date: Tue, 15 Dec 2015 09:44:55 +0100 Subject: [PATCH 65/67] Add the main property to the package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 4005577..147e92d 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "name" : "jquery-slimscroll", + "main" : "jquery.slimscroll.js", "version" : "1.3.8", "title" : "jQuery slimScroll scrollbar", "description" : "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", From cf39d364e777ef95574c30c42d3b85cb2bf325d3 Mon Sep 17 00:00:00 2001 From: Piotr Rochala Date: Sat, 11 Jun 2016 19:19:14 +1000 Subject: [PATCH 66/67] Update minified file --- jquery.slimscroll.min.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jquery.slimscroll.min.js b/jquery.slimscroll.min.js index 2683487..7531ab3 100644 --- a/jquery.slimscroll.min.js +++ b/jquery.slimscroll.min.js @@ -6,11 +6,11 @@ * */ (function(e){e.fn.extend({slimScroll:function(f){var a=e.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},f);this.each(function(){function v(d){if(r){d=d||window.event; -var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);e(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&n(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function n(d,e,f){k=!1;var g=d,h=b.outerHeight()-c.outerHeight();e&&(g=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),g=Math.min(Math.max(g,0),h),g=0=b.outerHeight()?k=!0:(c.stop(!0, -!0).fadeIn("fast"),a.railVisible&&m.stop(!0,!0).fadeIn("fast"))}function q(){a.alwaysVisible||(B=setTimeout(function(){a.disableFadeOut&&r||y||z||(c.fadeOut("slow"),m.fadeOut("slow"))},1E3))}var r,y,z,B,A,u,l,C,k=!1,b=e(this);if(b.parent().hasClass(a.wrapperClass)){var p=b.scrollTop(),c=b.siblings("."+a.barClass),m=b.siblings("."+a.railClass);x();if(e.isPlainObject(f)){if("height"in f&&"auto"==f.height){b.parent().css("height","auto");b.css("height","auto");var h=b.parent().parent().height();b.parent().css("height", -h);b.css("height",h)}else"height"in f&&(h=f.height,b.parent().css("height",h),b.css("height",h));if("scrollTo"in f)p=parseInt(a.scrollTo);else if("scrollBy"in f)p+=parseInt(a.scrollBy);else if("destroy"in f){c.remove();m.remove();b.unwrap();return}n(p,!1,!0)}}else if(!(e.isPlainObject(f)&&"destroy"in f)){a.height="auto"==a.height?b.parent().height():a.height;p=e("
    ").addClass(a.wrapperClass).css({position:"relative",overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden", +var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);e(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&n(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function n(d,g,e){k=!1;var f=b.outerHeight()-c.outerHeight();g&&(g=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),g=Math.min(Math.max(g,0),f),g=0=b.outerHeight()?k=!0:(c.stop(!0, +!0).fadeIn("fast"),a.railVisible&&m.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(B=setTimeout(function(){a.disableFadeOut&&r||y||z||(c.fadeOut("slow"),m.fadeOut("slow"))},1E3))}var r,y,z,B,A,u,l,C,k=!1,b=e(this);if(b.parent().hasClass(a.wrapperClass)){var q=b.scrollTop(),c=b.siblings("."+a.barClass),m=b.siblings("."+a.railClass);x();if(e.isPlainObject(f)){if("height"in f&&"auto"==f.height){b.parent().css("height","auto");b.css("height","auto");var h=b.parent().parent().height();b.parent().css("height", +h);b.css("height",h)}else"height"in f&&(h=f.height,b.parent().css("height",h),b.css("height",h));if("scrollTo"in f)q=parseInt(a.scrollTo);else if("scrollBy"in f)q+=parseInt(a.scrollBy);else if("destroy"in f){c.remove();m.remove();b.unwrap();return}n(q,!1,!0)}}else if(!(e.isPlainObject(f)&&"destroy"in f)){a.height="auto"==a.height?b.parent().height():a.height;q=e("
    ").addClass(a.wrapperClass).css({position:"relative",overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden", width:a.width,height:a.height});var m=e("
    ").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=e("
    ").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible?"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius, -WebkitBorderRadius:a.borderRadius,zIndex:99}),h="right"==a.position?{right:a.distance}:{left:a.distance};m.css(h);c.css(h);b.wrap(p);b.parent().append(c);b.parent().append(m);a.railDraggable&&c.bind("mousedown",function(a){var b=e(document);z=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);n(0,c.position().top,!1)});b.bind("mouseup.slimscroll",function(a){z=!1;q();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll", -function(a){a.stopPropagation();a.preventDefault();return!1});m.hover(function(){w()},function(){q()});c.hover(function(){y=!0},function(){y=!1});b.hover(function(){r=!0;w();q()},function(){r=!1;q()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(A=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&&(n((A-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),A=b.originalEvent.touches[0].pageY)}); +WebkitBorderRadius:a.borderRadius,zIndex:99}),h="right"==a.position?{right:a.distance}:{left:a.distance};m.css(h);c.css(h);b.wrap(q);b.parent().append(c);b.parent().append(m);a.railDraggable&&c.bind("mousedown",function(a){var b=e(document);z=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);n(0,c.position().top,!1)});b.bind("mouseup.slimscroll",function(a){z=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll", +function(a){a.stopPropagation();a.preventDefault();return!1});m.hover(function(){w()},function(){p()});c.hover(function(){y=!0},function(){y=!1});b.hover(function(){r=!0;w();p()},function(){r=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(A=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&&(n((A-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),A=b.originalEvent.touches[0].pageY)}); x();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),n(0,!0)):"top"!==a.start&&(n(e(a.start).position().top,null,!0),a.alwaysVisible||c.hide());window.addEventListener?(this.addEventListener("DOMMouseScroll",v,!1),this.addEventListener("mousewheel",v,!1)):document.attachEvent("onmousewheel",v)}});return this}});e.fn.extend({slimscroll:e.fn.slimScroll})})(jQuery); \ No newline at end of file From d01f84978d8c797fa6a9e65616a0d0999aecc183 Mon Sep 17 00:00:00 2001 From: muhammadumairaslam Date: Tue, 12 Feb 2019 23:40:26 +0500 Subject: [PATCH 67/67] mouse wheel not working on new browser with the help of below article. https://stackoverflow.com/questions/14926366/mousewheel-event-in-modern-browsers --- jquery.slimscroll.js | 1 + 1 file changed, 1 insertion(+) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 90caed3..1c6a53b 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -392,6 +392,7 @@ { target.addEventListener('DOMMouseScroll', _onWheel, false ); target.addEventListener('mousewheel', _onWheel, false ); + target.addEventListener('wheel', _onWheel, false); } else {