Skip to content

Commit

Permalink
Updated component to version 2.2.11
Browse files Browse the repository at this point in the history
  • Loading branch information
Semantic-Pusher-Robot committed Jul 11, 2017
1 parent d2b64f1 commit 2cb4688
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 18 deletions.
7 changes: 7 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### Version 2.2.11 - July 11, 2017

- **Sticky** - Fix issue where sticky would cause page to shift when `context` height was determined by sticky's height in `position: static;` [#3430](https://github.com/Semantic-Org/Semantic-UI/issues/3430)
- **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](https://github.com/Semantic-Org/Semantic-UI/issues/4360)
- **Sticky** - Fixed edge case where using `offset` setting, sticky element would not internally scroll if the rail contents (without the offset setting) would fit on screen
- **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](https://github.com/Semantic-Org/Semantic-UI/issues/4360)

### Version 2.2.5 - October, 27, 2016

- **Sticky** - Adds `container` setting. This can be used to specify the offsetParent of the sticky element and avoid having to calculate on initialization (improving performance)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"framework"
],
"license": "MIT",
"version": "2.2.10"
"version": "2.2.11"
}
29 changes: 23 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* # Semantic UI 2.2.10 - Sticky
* # Semantic UI 2.2.11 - Sticky
* http://github.com/semantic-org/semantic-ui/
*
*
Expand Down Expand Up @@ -287,7 +287,8 @@ module.exports = function(parameters) {
context.offset.left += scrollContext.left;
}
module.cache = {
fits : ( element.height < scrollContext.height ),
fits : ( (element.height + settings.offset) <= scrollContext.height),
sameHeight : (element.height == context.height),
scrollContext : {
height : scrollContext.height
},
Expand All @@ -306,7 +307,7 @@ module.exports = function(parameters) {
}
};
module.set.containerSize();
module.set.size();

module.stick();
module.debug('Caching element positions', module.cache);
}
Expand Down Expand Up @@ -375,6 +376,11 @@ module.exports = function(parameters) {
elementScroll: function(scroll) {
delete module.elementScroll;
},
minimumSize: function() {
$container
.css('min-height', '')
;
},
offset: function() {
$module.css('margin-top', '');
}
Expand Down Expand Up @@ -468,6 +474,7 @@ module.exports = function(parameters) {
cachedPosition = scroll || $scroll.scrollTop(),
cache = module.cache,
fits = cache.fits,
sameHeight = cache.sameHeight,
element = cache.element,
scrollContext = cache.scrollContext,
context = cache.context,
Expand All @@ -487,8 +494,7 @@ module.exports = function(parameters) {
doesntFit = !fits,
elementVisible = (element.height !== 0)
;

if(elementVisible) {
if(elementVisible && !sameHeight) {

if( module.is.initialPosition() ) {
if(scroll.top >= context.bottom) {
Expand Down Expand Up @@ -615,6 +621,9 @@ module.exports = 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
Expand All @@ -633,6 +642,9 @@ module.exports = 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
Expand Down Expand Up @@ -664,6 +676,7 @@ module.exports = 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)
Expand Down Expand Up @@ -899,7 +912,11 @@ _module.exports.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,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "semantic-ui-sticky",
"version": "2.2.10",
"version": "2.2.11",
"title": "Semantic UI - Sticky",
"description": "Single component release of sticky",
"homepage": "http://www.semantic-ui.com",
Expand Down
2 changes: 1 addition & 1 deletion sticky.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* # Semantic UI 2.2.10 - Sticky
* # Semantic UI 2.2.11 - Sticky
* http://github.com/semantic-org/semantic-ui/
*
*
Expand Down
29 changes: 23 additions & 6 deletions sticky.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* # Semantic UI 2.2.10 - Sticky
* # Semantic UI 2.2.11 - Sticky
* http://github.com/semantic-org/semantic-ui/
*
*
Expand Down Expand Up @@ -286,7 +286,8 @@ $.fn.sticky = function(parameters) {
context.offset.left += scrollContext.left;
}
module.cache = {
fits : ( element.height < scrollContext.height ),
fits : ( (element.height + settings.offset) <= scrollContext.height),
sameHeight : (element.height == context.height),
scrollContext : {
height : scrollContext.height
},
Expand All @@ -305,7 +306,7 @@ $.fn.sticky = function(parameters) {
}
};
module.set.containerSize();
module.set.size();

module.stick();
module.debug('Caching element positions', module.cache);
}
Expand Down Expand Up @@ -374,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', '');
}
Expand Down Expand Up @@ -467,6 +473,7 @@ $.fn.sticky = function(parameters) {
cachedPosition = scroll || $scroll.scrollTop(),
cache = module.cache,
fits = cache.fits,
sameHeight = cache.sameHeight,
element = cache.element,
scrollContext = cache.scrollContext,
context = cache.context,
Expand All @@ -486,8 +493,7 @@ $.fn.sticky = function(parameters) {
doesntFit = !fits,
elementVisible = (element.height !== 0)
;

if(elementVisible) {
if(elementVisible && !sameHeight) {

if( module.is.initialPosition() ) {
if(scroll.top >= context.bottom) {
Expand Down Expand Up @@ -614,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
Expand All @@ -632,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
Expand Down Expand Up @@ -663,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)
Expand Down Expand Up @@ -898,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,
Expand Down
2 changes: 1 addition & 1 deletion sticky.min.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* # Semantic UI 2.2.10 - Sticky
* # Semantic UI 2.2.11 - Sticky
* http://github.com/semantic-org/semantic-ui/
*
*
Expand Down
Loading

0 comments on commit 2cb4688

Please sign in to comment.