This repository was archived by the owner on Jan 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " stickymadness" ,
3- "version" : " 0.0.1 " ,
3+ "version" : " 0.1.0 " ,
44 "description" : " " ,
55 "main" : " src/sticky.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change 191191 // only calcul position relative to vewport
192192 this . updatePosition ( ) ;
193193
194- console . log ( this . position , this . offsetTop ) ;
195-
196- console . log ( 'limit : ' , this . limitTop , this . limitBottom ) ;
194+ if ( this . el . offsetHeight >= ( this . limitBottom - this . limitTop ) ) {
195+ this . disable ( ) ;
196+ return ;
197+ }
197198
198199 // ON STICK
199200 if ( ! this . isSticked && this . position . offsetTop < this . offsetTop ) {
210211 }
211212
212213 // ON STUCK
213- if ( ! this . isStucked && this . position . bottom >= this . limitBottom ) {
214+ if ( ! this . isStucked && this . position . bottom > this . limitBottom ) {
214215 this . el . classList . add ( this . options . stuckClass ) ;
215216 this . options . onStuck ( this . el ) ;
216217 }
217218
218219 // ON DESTUCK
219- if ( this . isStucked && this . position . offsetTop >= this . offsetTop ) {
220+ if ( this . isStucked && this . position . offsetTop > this . offsetTop ) {
220221 this . el . classList . remove ( this . options . stuckClass ) ;
221222 this . options . onUnStuck ( this . el ) ;
222223 }
You can’t perform that action at this time.
0 commit comments