@@ -3,7 +3,6 @@ import Vue from 'vue';
3
3
export const inviewport = {
4
4
inserted : function ( el , binding ) {
5
5
//DATA
6
- var pageHeight = null ;
7
6
var elem = null ;
8
7
var viewport = null ;
9
8
var scrollY = null ;
@@ -32,7 +31,6 @@ export const inviewport = {
32
31
terminal . style . cssText = "position: fixed;top:0;right:0;background-color:#000;color: #fff;width: 300px;height: 300px;z-index: 100;opacity: .8;padding:15px;" ;
33
32
document . body . appendChild ( terminal ) ;
34
33
35
-
36
34
var marginTop = document . createElement ( "div" ) ;
37
35
marginTop . style . cssText = "position:fixed;height: 1px;width: 100%;background-color: red;left:0;z-index: 50;top:" + viewportTopMargin + "px;" ;
38
36
document . body . appendChild ( marginTop ) ;
@@ -48,11 +46,6 @@ export const inviewport = {
48
46
}
49
47
50
48
//FUNCTIONS
51
- var getPageHeight = function ( ) {
52
- var _body = document . body , _html = document . documentElement ;
53
- return Math . max ( _body . scrollHeight , _body . offsetHeight , _html . clientHeight , _html . scrollHeight , _html . offsetHeight ) ;
54
- } ;
55
-
56
49
var getElemClientRect = function ( ) {
57
50
return JSON . parse ( JSON . stringify ( el . getBoundingClientRect ( ) ) ) ;
58
51
} ;
@@ -120,14 +113,12 @@ export const inviewport = {
120
113
121
114
//UPDATE FUNCTION
122
115
var updatePositions = function ( ) {
123
- pageHeight = getPageHeight ( ) ;
124
116
elem = getElemClientRect ( ) ;
125
117
viewport = getViewportHeight ( ) ;
126
118
scrollY = getScrollY ( ) ;
127
119
elementPos = checkPosition ( ) ;
128
120
if ( debugMode ) {
129
121
console . log ( '--------------------------' )
130
- console . log ( 'pageHeight = ' + pageHeight ) ;
131
122
console . log ( 'elem.top = ' + elem . top ) ;
132
123
console . log ( 'elem.bottom = ' + elem . bottom ) ;
133
124
console . log ( 'viewport = ' + viewport ) ;
@@ -136,7 +127,6 @@ export const inviewport = {
136
127
console . log ( 'viewportBottomMargin = ' + viewportBottomMargin ) ;
137
128
console . log ( 'elementPos = ' + elementPos ) ;
138
129
var html = '' ;
139
- html += 'pageHeight = ' + pageHeight + '<br />' ;
140
130
html += 'viewport = ' + viewport + '<br />' ;
141
131
html += 'scrollY = ' + scrollY + '<br />' ;
142
132
html += 'viewportTopMargin = ' + viewportTopMargin + '<br />' ;
0 commit comments