cronos cronos - 6 months ago 11
CSS Question

Fade the output after 1 second

I am trying to display the dimensions of the window and finally I was able to do it:

All i want now is to fade the output text after one second after the resize happened; is this possible?

Code here [code][1]

[1]: https://jsfiddle.net/r1vmjxx9/

Answer
  $(window).on('resize', showSize);
  showSize();
  function showSize() {
    $('#size').show(); // show
    $('#size').html($(window).height() + 'px x ' + $(window).width() + 'px');
    setTimeout(function(){
        $('#size').fadeOut(); // hide after 1 second
    }, 1000);
  }

updated fiddle: https://jsfiddle.net/r1vmjxx9/2/

Comments