diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 252a85bf7..b47cc29cc 100755 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -11,6 +11,7 @@ - **Popup** - Separated className setting for `visible` into `visible` and `popupVisible`, this way you can remove visible indiciation on activating element without modifying popup. - **Build Tools** - All Gulp/NPM dependencies have been updated to their latest versions - **Site** - Site now includes custom scrollbar styles for UI (not page) by default in WebKit/Chrome. You can disable this by setting `@useCustomScrollbars: false` in your `site.variables` +- **Sticky** - Sticky now includes a new setting `setSize` to determine whether it should set content size on stick to the size before sticking (fixed content uses different positioning system) #4360 **Bugs** - **Modal** - Using multiple modals with different `inverted` `blurring` or `closable` settings will no longer in some cases inherit the options of other modals #4368 @@ -29,6 +30,7 @@ - **Message** - Fix issue with `compact icon message` not appearing compact #4759 - **Menu** - Fixed issue where `left menu` and `right menu` did not display correctly in `stackable menu` on mobile #3604 #5116 **Thanks @BleuDiamant @Traverse** - **Popup** - Fixed issue where popup would incorrectly add itself to the wrong offset context when using `popup` and `target` setting together in cases where the `target` has a different `offsetParent` than the activating element. +- **Sticky** - Fixed an issue where `ui sticky` used with a percentage based width would not resize properly if the content size of container changed when "stuck" #4360 - **Dimmer** - Fixed typo causing body dimmer to add unnecessary `position: relative;` **Thanks @jinyangzhen** #4707 ### Version 2.2.10 - March 28, 2017 diff --git a/src/definitions/modules/sticky.js b/src/definitions/modules/sticky.js old mode 100644 new mode 100755 index 8b131b5e3..4887c9859 --- a/src/definitions/modules/sticky.js +++ b/src/definitions/modules/sticky.js @@ -306,7 +306,7 @@ $.fn.sticky = function(parameters) { } }; module.set.containerSize(); - module.set.size(); + module.stick(); module.debug('Caching element positions', module.cache); } @@ -375,6 +375,11 @@ $.fn.sticky = function(parameters) { elementScroll: function(scroll) { delete module.elementScroll; }, + minimumSize: function() { + $container + .css('min-height', '') + ; + }, offset: function() { $module.css('margin-top', ''); } @@ -615,6 +620,9 @@ $.fn.sticky = function(parameters) { fixTop: function() { module.debug('Fixing element to top of page'); + if(settings.setSize) { + module.set.size(); + } module.set.minimumSize(); module.set.offset(); $module @@ -633,6 +641,9 @@ $.fn.sticky = function(parameters) { fixBottom: function() { module.debug('Sticking element to bottom of page'); + if(settings.setSize) { + module.set.size(); + } module.set.minimumSize(); module.set.offset(); $module @@ -664,6 +675,7 @@ $.fn.sticky = function(parameters) { unfix: function() { if( module.is.fixed() ) { module.debug('Removing fixed position on element'); + module.remove.minimumSize(); module.remove.offset(); $module .removeClass(className.fixed) @@ -899,7 +911,11 @@ $.fn.sticky.settings = { // Offset to adjust scroll when attached to bottom of screen bottomOffset : 0, - jitter : 5, // will only set container height if difference between context and container is larger than this number + // will only set container height if difference between context and container is larger than this number + jitter : 5, + + // set width of sticky element when it is fixed to page (used to make sure 100% width is maintained if no fixed size set) + setSize : true, // Whether to automatically observe changes with Mutation Observers observeChanges : false,