BrentonCozby / dom-slider

Plain JavaScript version of jQuery's slideToggle(), slideDown(), & slideUp(), but does not use display: none.
MIT License
61 stars 7 forks source link

Cannot redefine property: slideDown #8

Closed jonaswebdev closed 4 years ago

jonaswebdev commented 5 years ago

Hi, I created a little script which uses "dom-slider" and working well "alone", but when I put on production website where there are many other scripts, including jQuery, I got this error: Cannot redefine property: slideDown.

I research quickly and saw something related with "slideDown" (re)declaration (source).

I don't know it's a problem on my side, and there is a way to avoid this conflict, like the "dom-slider" method should work only my application scope. Or if you could fix it following the idea on define configurable: true but we need to think on the "side-effects" from this change.

Let me know you think about this, please.

Thanks in advance

PS: there is a question and some comments, maybe could help us :)

julkue commented 5 years ago

Suggestion: Avoid manipulating DOM properties and methods and make it an exportable module with methods to call. Then we can create an instance and call slide methods, instead of calling DOM methods which causes these conflicts.

BrentonCozby commented 4 years ago

Hey, I've made that update. Sort of...it's not exportable, but the methods are no longer on the DOM prototypes. These are breaking changes so I've bumped the version from 1.x.x to 2.0.0.