JavaScript slidedown without jQuery -


I want to make a similar effect on the jQuery slider but without without jQuery or any other Libary To use. I know that "possible" because anything in jQuery can be done in plain javascript. Just hard work

I can not use jQuery because everything does not need to be written in my own code.

Has anyone done something like this or just used plain javascript?

Here is a nice piece of code that I wrote from scratch, it only time Based .

  var minheight = 20; Var maxheit = 100; Var time = 1000; Var timer = null; Var toggled = false; Window.onload = function () {var controler = document.getElementById ('Slide'); Var slider = document.getElementById ('slider'); Slider.style.height = Minhite + 'Px'; // Not just that, my example controler.onclick = function () {for clear interval (timer); Var instanceheight = parseInt (slider.style.height); // current height var init = (new date ()). GetTime (); // Start time var height = (toggled =! Toggled)? MaxHead: Minhite; // if toggled var disp = height - parseInt (slider.style.height); Timer = setInterval (function () {var instance = (New date ()) GetTime () - init; // Animating time if (example & lt; = time) {// 0 -> time seconds var pos = Instanceheight + Math.floor (disp * instance / time); slider.style.height = pos + 'px';} else {slider.style.height = height + 'px'; // security side ^^ clear interval (timer );}}, 1); }; };  

Test here:


Comments