1
0
mirror of synced 2025-12-08 14:54:02 +08:00

Fix: Position fixed highlight

This commit is contained in:
surunzi
2016-05-20 20:46:48 +08:00
parent 42b4a9cf59
commit 1c51b6b691
4 changed files with 8 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "eruda",
"version": "0.5.3",
"version": "0.5.5",
"description": "Console for Mobile Browsers",
"main": "dist/eruda.js",
"scripts": {

View File

@@ -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)

View File

@@ -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>

View File

@@ -8,4 +8,9 @@ html {
}
.border {
border: 15px solid #fff;
}
.fixed-footer {
position: fixed;
left: 0;
bottom: 0;
}