[openstreetmap/openstreetmap-website] history-sidebar width scroll (#1422)

Holger Jeromin notifications at github.com
Wed Feb 1 16:26:21 UTC 2017


HolgerJeromin requested changes on this pull request.



> @@ -72,7 +72,27 @@ $(document).ready(function () {
       }
     });
   };
-
+  $(document).ready(function(){
+    $('#sidebar').on('mousedown', function(e){
+        var $dragable = $(this),
+            startWidth = $dragable.width(),
+            pX = e.pageX;
+        
+        $(document).on('mouseup', function(e){
+            $(document).off('mouseup').off('mousemove');

Deregister every mouseup and mousemove could generate problems. jQuery has namespaces in events for that. 
Saving the jQuery document object in a variable seems cleaner than multiple $(document) 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/1422#pullrequestreview-19451985
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20170201/b8c8fa59/attachment.html>


More information about the rails-dev mailing list