Skip to content

Commit

Permalink
Updated component to version 2.2.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Semantic-Pusher-Robot committed Mar 29, 2017
1 parent a159310 commit a52c911
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 11 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.2.10 - March 28, 2017

- **Visibility** - Visibility events now fire correctly when using `context` other than body that has `overflow-x` or `overflow-y` set to `auto` or `scroll`
- **Visibility** - Fixed bug where using visibility with `context` setting on a scrollable context (with overflow) would cause callbacks to fire incorrectly
- **Visibility** - Fixed bug where `top passed` and `bottom passed` would appear as incorrect values if using settings from `get element calculations` when element is off screen.

#### Dropdown

- **Visibility** - Added documentation for `onOnscreen` and `onOffScreen`, two very important callbacks that occur when an element is or isn't in currently scrolled view.
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.9"
"version": "2.2.10"
}
29 changes: 26 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* # Semantic UI 2.2.9 - Visibility
* # Semantic UI 2.2.10 - Visibility
* http://github.com/semantic-org/semantic-ui/
*
*
Expand Down Expand Up @@ -423,6 +423,22 @@ module.exports = function(parameters) {
return !(module.cache.element.width === 0 && module.cache.element.offset.top === 0);
}
return false;
},
verticallyScrollableContext: function() {
var
overflowY = ($context.get(0) !== window)
? $context.css('overflow-y')
: false
;
return (overflowY == 'auto' || overflowY == 'scroll');
},
horizontallyScrollableContext: function() {
var
overflowX = ($context.get(0) !== window)
? $context.css('overflow-x')
: false
;
return (overflowX == 'auto' || overflowX == 'scroll');
}
},

Expand Down Expand Up @@ -880,6 +896,13 @@ module.exports = function(parameters) {
element.offset = $module.offset();
element.width = $module.outerWidth();
element.height = $module.outerHeight();
// compensate for scroll in context
if(module.is.verticallyScrollableContext()) {
element.offset.top += $context.scrollTop() - $context.offset().top;
}
if(module.is.horizontallyScrollableContext()) {
element.offset.left += $context.scrollLeft - $context.offset().left;
}
// store
module.cache.element = element;
return element;
Expand All @@ -903,10 +926,10 @@ module.exports = function(parameters) {
}

// visibility
element.topVisible = (screen.bottom >= element.top);
element.topPassed = (screen.top >= element.top);
element.bottomVisible = (screen.bottom >= element.bottom);
element.bottomPassed = (screen.top >= element.bottom);
element.topVisible = (screen.bottom >= element.top) && !element.bottomPassed;
element.bottomVisible = (screen.bottom >= element.bottom) && !element.topPassed;
element.pixelsPassed = 0;
element.percentagePassed = 0;

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-visibility',
summary : 'Semantic UI - Visibility: Single component release',
version : '2.2.9',
version : '2.2.10',
git : 'git://github.com/Semantic-Org/UI-Visibility.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-visibility",
"version": "2.2.9",
"version": "2.2.10",
"title": "Semantic UI - Visibility",
"description": "Single component release of visibility",
"homepage": "http://www.semantic-ui.com",
Expand Down
29 changes: 26 additions & 3 deletions visibility.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* # Semantic UI 2.2.9 - Visibility
* # Semantic UI 2.2.10 - Visibility
* http://github.com/semantic-org/semantic-ui/
*
*
Expand Down Expand Up @@ -422,6 +422,22 @@ $.fn.visibility = function(parameters) {
return !(module.cache.element.width === 0 && module.cache.element.offset.top === 0);
}
return false;
},
verticallyScrollableContext: function() {
var
overflowY = ($context.get(0) !== window)
? $context.css('overflow-y')
: false
;
return (overflowY == 'auto' || overflowY == 'scroll');
},
horizontallyScrollableContext: function() {
var
overflowX = ($context.get(0) !== window)
? $context.css('overflow-x')
: false
;
return (overflowX == 'auto' || overflowX == 'scroll');
}
},

Expand Down Expand Up @@ -879,6 +895,13 @@ $.fn.visibility = function(parameters) {
element.offset = $module.offset();
element.width = $module.outerWidth();
element.height = $module.outerHeight();
// compensate for scroll in context
if(module.is.verticallyScrollableContext()) {
element.offset.top += $context.scrollTop() - $context.offset().top;
}
if(module.is.horizontallyScrollableContext()) {
element.offset.left += $context.scrollLeft - $context.offset().left;
}
// store
module.cache.element = element;
return element;
Expand All @@ -902,10 +925,10 @@ $.fn.visibility = function(parameters) {
}

// visibility
element.topVisible = (screen.bottom >= element.top);
element.topPassed = (screen.top >= element.top);
element.bottomVisible = (screen.bottom >= element.bottom);
element.bottomPassed = (screen.top >= element.bottom);
element.topVisible = (screen.bottom >= element.top) && !element.bottomPassed;
element.bottomVisible = (screen.bottom >= element.bottom) && !element.topPassed;
element.pixelsPassed = 0;
element.percentagePassed = 0;

Expand Down
Loading

0 comments on commit a52c911

Please sign in to comment.