Fix: Position fixed highlight
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "eruda",
|
||||
"version": "0.5.3",
|
||||
"version": "0.5.5",
|
||||
"description": "Console for Mobile Browsers",
|
||||
"main": "dist/eruda.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -7,7 +7,6 @@ export default class Highlight
|
||||
require('./Highlight.scss');
|
||||
|
||||
this._isShow = false;
|
||||
this._top = 0;
|
||||
|
||||
this._appendTpl($parent);
|
||||
this._bindEvent();
|
||||
@@ -32,7 +31,6 @@ export default class Highlight
|
||||
{
|
||||
var {left, width, top, height} = this._$target.offset();
|
||||
|
||||
this._top = top;
|
||||
this._$el.css({left, top: top - window.scrollY, width, height});
|
||||
|
||||
var computedStyle = getComputedStyle(this._target, '');
|
||||
@@ -88,7 +86,7 @@ export default class Highlight
|
||||
window.addEventListener('scroll', () =>
|
||||
{
|
||||
if (!this._isShow) return;
|
||||
this._$el.css('top', this._top - window.scrollY);
|
||||
this.render();
|
||||
}, false);
|
||||
}
|
||||
_appendTpl($parent)
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
This is a very long text!
|
||||
This is a very long text!
|
||||
</div>
|
||||
<div class="fixed-footer">This is a footer!</div>
|
||||
<div>
|
||||
<img src="http://7xn2zy.com1.z0.glb.clouddn.com/blog_elf.jpg">
|
||||
</div>
|
||||
|
||||
@@ -8,4 +8,9 @@ html {
|
||||
}
|
||||
.border {
|
||||
border: 15px solid #fff;
|
||||
}
|
||||
.fixed-footer {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
Reference in New Issue
Block a user