Animation with pure javascript, without jquery

I used the jquery / jquery-ui slideDown() animation function for a specific task. Now it turns out that I will not be able to use jQuery in this project. I also can not use YUI or any other libraries. So I'm wondering if there is a way to do slideDown style animation using pure javascript?

Edit: I need to do this without jQuery, because I use selenium to control the web page on this particular site, adding that jQuery on the page interrupts the event handlers for some reason.

+4
source share
2 answers

The obvious answer is yes ... quick question ... could you not just load jQuery into ASYNC in the document and then use it after the fact or not use it due to other restrictions?

In the worst case, you can snatch the part you need, but that doesn't make much sense. If you can edit any of the JS, you can easily insert jQuery right above your code.

+2
source

You can make slides and animations using CSS3, for example

 .slidable { position: relative; -webkit-animation: Slider 2s ease-in-out; } @-webkit-keyframes Slider { from { top: 0px; } to { top: 100px; } } 

Use -moz- for Firefox. Javascript can also make movements, just put them in timers, for example.

 var top = 0; window.Timeout(MoveSomething, 10); function MoveSomething { var el = document.getElementById('moveme'); top += 2; el.style.top = top + 'px'; if (top < 100) window.Timeout(MoveSomething, 10); } 

Coding just required!

+5
source

Source: https://habr.com/ru/post/1388499/


All Articles