<a href="#box" onclick="openbox('box'); return false">Открыть бокс</a>
<div id="box" style="display: none; transition-duration: width 2s;">Содержимое блока</div>
function openbox(box) {
display = document.getElementById('box').style.display;
if(display == "none") {
document.getElementById('box').style.display = "block";
} else {
document.getElementById('box').style.display = "none";
}
}
(function() {
'use strict';
setTimeout(function() {
fadeIn(document.querySelector('.swapi'), 1500);
}, 1000);
function fadeIn(el, time) {
el.style.opacity = 0;
var last = +new Date();
var tick = function(time) {
el.style.opacity = +el.style.opacity + (new Date() - last) / (time || 300);
last = +new Date();
if (+el.style.opacity < 1) {
(window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16);
}
};
tick(time);
}
})()