From 32ecf62baca2e902e23259b4db0ebffff3b20dbd Mon Sep 17 00:00:00 2001 From: Remy Sharp Date: Sun, 1 Sep 2013 10:37:23 +0100 Subject: [PATCH] Tweak to splitter, don't do DOM manip if not dragging Sample: http://d.pr/i/pEKj --- public/js/chrome/splitter.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/public/js/chrome/splitter.js b/public/js/chrome/splitter.js index 18a2b912..7c9db4df 100644 --- a/public/js/chrome/splitter.js +++ b/public/js/chrome/splitter.js @@ -3,10 +3,10 @@ $blocker = $('
'), $body = $('body'); // blockiframe = $blocker.find('iframe')[0]; - + var splitterSettings = JSON.parse(localStorage.getItem('splitterSettings') || '[]'); return this.each(function () { - var $el = $(this), + var $el = $(this), $originalContainer = $(this), guid = $.fn.splitter.guid++, $parent = $el.parent(), @@ -143,10 +143,12 @@ } $document.bind('mouseup touchend', function () { - dragging = false; - $blocker.remove(); - // $handle.css( 'opacity', '0'); - $body.removeClass('dragging'); + if (dragging) { + dragging = false; + $blocker.remove(); + // $handle.css( 'opacity', '0'); + $body.removeClass('dragging'); + } }).bind('mousemove touchmove', function (event) { if (dragging) { moveSplitter(event[props[type].moveProp] || event.originalEvent.touches[0][props[type].moveProp]); @@ -198,7 +200,7 @@ $el.css('border-top', 0); // $prev.css('border-right', '2px solid #ccc'); } - + if ($el.is(':hidden')) { $handle.hide(); } else { @@ -276,7 +278,7 @@ var otherhandles = $el.find('.resize'); otherhandles.each(function (i) { - // find the top of the + // find the top of the var $h = $(this); if (this === $handle[0]) { // ignore