@@ -3,11 +3,10 @@ var il = itemsall.length;
33var vw = window . innerWidth ;
44
55for ( var i = 0 ; i < il ; i ++ ) {
6- if ( itemsall [ i ] . offsetWidth > vw ) {
7- console . log ( itemsall [ i ] ) ;
6+ var offset = itemsall [ i ] . getBoundingClientRect ( ) ;
7+ if ( offset . width > vw ) {
88itemsall [ i ] . setAttribute ( "style" , "border: 2px dashed red" ) ;
9- var topOffset = itemsall [ i ] . getBoundingClientRect ( ) . top ;
10- addOverflowWarning ( itemsall [ i ] , topOffset ) ;
9+ addOverflowWarning ( itemsall [ i ] , offset . top ) ;
1110}
1211} ;
1312
@@ -16,17 +15,19 @@ function addOverflowWarning(parent,offset) {
1615var overflowWarning = document . createElement ( 'span' ) ;
1716 overflowWarning . className = "overflowWarning" ;
1817
19- overflowWarning . style . position = "fixed " ;
20- overflowWarning . style . top = offset ;
18+ overflowWarning . style . position = "absolute " ;
19+ overflowWarning . style . top = offset + "px" ;
2120 overflowWarning . style . right = "0" ;
2221
2322overflowWarning . style . height = "0" ;
2423overflowWarning . style . width = "0" ;
2524overflowWarning . style . zIndex = "999" ;
2625
27- overflowWarning . style . borderTop = "10px solid transparent" ;
26+ overflowWarning . style . borderTop = "15px solid transparent" ;
2827overflowWarning . style . borderLeft = "30px solid red" ;
29- overflowWarning . style . borderBottom = "10px solid transparent" ;
30-
28+ overflowWarning . style . borderBottom = "15px solid transparent" ;
29+
30+ overflowWarning . innerHTML = '<span style="position:absolute; color: #fff; left: -25px; top: -12px;"> ! </span>' ;
31+
3132parent . appendChild ( overflowWarning ) ;
3233}
0 commit comments