From ca323e62183a3282bf805e6df98b4f302e565aa6 Mon Sep 17 00:00:00 2001 From: jlukic Date: Mon, 26 Jan 2015 15:32:22 -0500 Subject: [PATCH] Add observe change setting sticky --- RELEASE-NOTES.md | 1 + src/definitions/modules/sticky.js | 76 ++++++++++++++++--------------- 2 files changed, 41 insertions(+), 36 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index ebd572746..3814b6649 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -7,6 +7,7 @@ - **Input** - `ui labeled input` now forces `table-cell` so that it can use `ui dropdown` - **Input** - Fix border radius on `ui action input` with button groups, aka `ui buttons` - **Popup** - Popup `hide all` will now use transition set in `settings.transition` when closing other popups +- **Grid** - Fix `doubling grid` setting `100% width` which may cause ### Version 1.8.0 - January 23, 2015 diff --git a/src/definitions/modules/sticky.js b/src/definitions/modules/sticky.js index 09ed0d934..f90f23f76 100644 --- a/src/definitions/modules/sticky.js +++ b/src/definitions/modules/sticky.js @@ -125,23 +125,25 @@ $.fn.sticky = function(parameters) { var context = $context[0] ; - if('MutationObserver' in window) { - observer = new MutationObserver(function(mutations) { - clearTimeout(module.timer); - module.timer = setTimeout(function() { - module.verbose('DOM tree modified, updating sticky menu'); - module.refresh(); - }, 200); - }); - observer.observe(element, { - childList : true, - subtree : true - }); - observer.observe(context, { - childList : true, - subtree : true - }); - module.debug('Setting up mutation observer', observer); + if(settings.observeChanges) { + if('MutationObserver' in window) { + observer = new MutationObserver(function(mutations) { + clearTimeout(module.timer); + module.timer = setTimeout(function() { + module.verbose('DOM tree modified, updating sticky menu'); + module.refresh(); + }, 200); + }); + observer.observe(element, { + childList : true, + subtree : true + }); + observer.observe(context, { + childList : true, + subtree : true + }); + module.debug('Setting up mutation observer', observer); + } } }, @@ -730,25 +732,27 @@ $.fn.sticky = function(parameters) { $.fn.sticky.settings = { - name : 'Sticky', - namespace : 'sticky', - - debug : false, - verbose : false, - performance : false, - - pushing : false, - context : false, - scrollContext : window, - offset : 0, - bottomOffset : 0, - - onReposition : function(){}, - onScroll : function(){}, - onStick : function(){}, - onUnstick : function(){}, - onTop : function(){}, - onBottom : function(){}, + name : 'Sticky', + namespace : 'sticky', + + debug : false, + verbose : false, + performance : false, + + pushing : false, + context : false, + scrollContext : window, + offset : 0, + bottomOffset : 0, + + observeChanges : false, + + onReposition : function(){}, + onScroll : function(){}, + onStick : function(){}, + onUnstick : function(){}, + onTop : function(){}, + onBottom : function(){}, error : { container : 'Sticky element must be inside a relative container',