Skip to content

Commit

Permalink
Don't force body overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
zzarcon committed Dec 4, 2014
1 parent bfa4c3f commit c05ef9f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Focusable.hide();
```javascript
{
fadeDuration: 700,
hideOnClick: true,
hideOnESC: true,
hideOnClick: false,
hideOnESC: false,
findOnResize: false
}
```
Expand Down
8 changes: 5 additions & 3 deletions app/focus-element-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
var isVisible = false;
var options = {
fadeDuration: 700,
hideOnClick: true,
hideOnClick: false,
hideOnESC: false,
findOnResize: false
};
Expand All @@ -53,6 +53,9 @@
}

function resizeHandler() {
if (!$element) {
return;
}
//Refind the element
$element = options.findOnResize ? $($element.selector) : $element;

Expand All @@ -72,6 +75,7 @@
}

function setFocus($el, userOptions) {
$('body').css('overflow', 'hidden');
options = $.extend(options, userOptions);
$element = $el;
createColumns();
Expand Down Expand Up @@ -147,8 +151,6 @@

sheet.insertRule("#overlay-layer{ display:none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 9999; overflow: hidden; pointer-events: none; }", 0);
sheet.insertRule("#overlay-layer .column{ position: absolute; background: rgba(0,0,0,0.8); pointer-events: all; }", 1);

$('body').css('overflow', 'hidden');
}

exports.Focusable = {
Expand Down

0 comments on commit c05ef9f

Please sign in to comment.