Skip to content

Commit

Permalink
Updated component to version 2.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Semantic-Pusher-Robot committed Jul 17, 2015
1 parent 93501b0 commit c7e648f
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 31 deletions.
6 changes: 6 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### Version 2.0.4 - July 17, 2015

- **Sticky** - Fixed `sticky` element that cannot fit in viewport not scrolling correctly when fixed to viewport [#2605](https://github.com/Semantic-Org/Semantic-UI/issues/2605)
- **Sticky** - Fixed `sticky` content jumping from `fixed` to `bount bottom` when scroll position has surpassed bottom of container during page refresh.
- **Sticky** - Sticky no longer uses `bottomPadding` to determine bottom edge of container.

### Version 2.0.0 - June 30, 2015

- **Visibility** - Visibility and sticky now use a more performant [pub/sub pattern](http://davidwalsh.name/pubsub-javascript) that will only attach a single event to context `scroll`.
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.0.3"
"version": "2.0.4"
}
27 changes: 15 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* # Semantic UI 2.0.3 - Sticky
* # Semantic UI 2.0.4 - Sticky
* http://github.com/semantic-org/semantic-ui/
*
*
Expand Down Expand Up @@ -238,8 +238,7 @@ module.exports = function(parameters) {
},
context = {
offset : $context.offset(),
height : $context.outerHeight(),
bottomPadding : parseInt($context.css('padding-bottom'), 10)
height : $context.outerHeight()
},
container = {
height: $container.outerHeight()
Expand All @@ -261,8 +260,7 @@ module.exports = function(parameters) {
context: {
top : context.offset.top,
height : context.height,
bottomPadding : context.bottomPadding,
bottom : context.offset.top + context.height - context.bottomPadding
bottom : context.offset.top + context.height
}
};
module.set.containerSize();
Expand Down Expand Up @@ -458,8 +456,14 @@ module.exports = function(parameters) {
}
else if(scroll.top > element.top) {
module.debug('Element passed, fixing element to page');
module.fixTop();
if( (element.height + scroll.top - elementScroll) > context.bottom ) {
module.bindBottom();
}
else {
module.fixTop();
}
}

}
else if( module.is.fixed() ) {

Expand All @@ -476,6 +480,8 @@ module.exports = function(parameters) {
// scroll element if larger than screen
else if(doesntFit) {
module.set.scroll(elementScroll);
module.save.lastScroll(scroll.top);
module.save.elementScroll(elementScroll);
}
}

Expand All @@ -495,6 +501,8 @@ module.exports = function(parameters) {
// scroll element if larger than screen
else if(doesntFit) {
module.set.scroll(elementScroll);
module.save.lastScroll(scroll.top);
module.save.elementScroll(elementScroll);
}

}
Expand All @@ -514,10 +522,6 @@ module.exports = function(parameters) {
}
}
}

// save current scroll for next run
module.save.lastScroll(scroll.top);
module.save.elementScroll(elementScroll);
},

bindTop: function() {
Expand All @@ -543,8 +547,7 @@ module.exports = function(parameters) {
$module
.css({
left : '',
top : '',
marginBottom : module.cache.context.bottomPadding
top : ''
})
.removeClass(className.fixed)
.removeClass(className.top)
Expand Down
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Package.describe({
name : 'semantic:ui-sticky',
summary : 'Semantic UI - Sticky: Single component release',
version : '2.0.3',
version : '2.0.4',
git : 'git://github.com/Semantic-Org/UI-Sticky.git',
});

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.0.3",
"version": "2.0.4",
"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.0.3 - Sticky
* # Semantic UI 2.0.4 - Sticky
* http://github.com/semantic-org/semantic-ui/
*
*
Expand Down
27 changes: 15 additions & 12 deletions sticky.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* # Semantic UI 2.0.3 - Sticky
* # Semantic UI 2.0.4 - Sticky
* http://github.com/semantic-org/semantic-ui/
*
*
Expand Down Expand Up @@ -237,8 +237,7 @@ $.fn.sticky = function(parameters) {
},
context = {
offset : $context.offset(),
height : $context.outerHeight(),
bottomPadding : parseInt($context.css('padding-bottom'), 10)
height : $context.outerHeight()
},
container = {
height: $container.outerHeight()
Expand All @@ -260,8 +259,7 @@ $.fn.sticky = function(parameters) {
context: {
top : context.offset.top,
height : context.height,
bottomPadding : context.bottomPadding,
bottom : context.offset.top + context.height - context.bottomPadding
bottom : context.offset.top + context.height
}
};
module.set.containerSize();
Expand Down Expand Up @@ -457,8 +455,14 @@ $.fn.sticky = function(parameters) {
}
else if(scroll.top > element.top) {
module.debug('Element passed, fixing element to page');
module.fixTop();
if( (element.height + scroll.top - elementScroll) > context.bottom ) {
module.bindBottom();
}
else {
module.fixTop();
}
}

}
else if( module.is.fixed() ) {

Expand All @@ -475,6 +479,8 @@ $.fn.sticky = function(parameters) {
// scroll element if larger than screen
else if(doesntFit) {
module.set.scroll(elementScroll);
module.save.lastScroll(scroll.top);
module.save.elementScroll(elementScroll);
}
}

Expand All @@ -494,6 +500,8 @@ $.fn.sticky = function(parameters) {
// scroll element if larger than screen
else if(doesntFit) {
module.set.scroll(elementScroll);
module.save.lastScroll(scroll.top);
module.save.elementScroll(elementScroll);
}

}
Expand All @@ -513,10 +521,6 @@ $.fn.sticky = function(parameters) {
}
}
}

// save current scroll for next run
module.save.lastScroll(scroll.top);
module.save.elementScroll(elementScroll);
},

bindTop: function() {
Expand All @@ -542,8 +546,7 @@ $.fn.sticky = function(parameters) {
$module
.css({
left : '',
top : '',
marginBottom : module.cache.context.bottomPadding
top : ''
})
.removeClass(className.fixed)
.removeClass(className.top)
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.0.3 - Sticky
* # Semantic UI 2.0.4 - Sticky
* http://github.com/semantic-org/semantic-ui/
*
*
Expand Down
4 changes: 2 additions & 2 deletions sticky.min.js

Large diffs are not rendered by default.

0 comments on commit c7e648f

Please sign in to comment.