A
A
Alexander2015-10-15 11:06:51
JavaScript
Alexander, 2015-10-15 11:06:51

How to rewrite jquery code to javascript?

$('body').before('<div class="load"><img id="ls" src="http://plasmon.rghost.ru/6lWFXm4KD/image.png" alt="" style="position: absolute; top: 50%; left: 50%"></div>');
    $(document).ready(function () {
        setTimeout(function () {
            $('div.load').hide();
            $('body').css('display', 'block');
        }, 3000);
    });

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Ineshin, 2015-10-15
@kentuck1213

Use hints from here: youmightnotneedjquery.com

M
Magzhan Birgebayuly, 2015-10-15
@henhanshi

It was a long time ago ... I could be wrong ...

var d = document.createElement('div'), di = new Image();
d.className = 'load';
di.src = 'http://plasmon.rghost.ru/6lWFXm4KD/image.png';
di.style = 'position: absolute; top: 50%; left: 50%';
d.appendChild(di);
document.getElementsByTagName('body')[0].insertBefore(d, document.body.firstChild);
document.onload = function(){
  setTimeout(function(){
    d.style.display = 'none';
    document.body.style.display = 'block';
  }, 3000);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question