Home >Web Front-end >HTML Tutorial >Pure css simple warning box with jitter effect_html/css_WEB-ITnose

Pure css simple warning box with jitter effect_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:49:121664browse

The warning box with this effect will shake if something goes wrong

.alert-box { width: 400px; border-style: outset; position: relative; color:#555; border-radius:10px; font-family:Tahoma,Geneva,Arial,sans-serif;font-size:11px; padding:10px 10px 10px 10px; margin:auto; display: none; }      .alert-box span { font-weight:bold; text-transform:uppercase; }      .error { background:#ffecec no-repeat 10px 50%; border:1px solid #f5aca6; }

jQuery animation effect, animate for loop 4 times to move around

var $box = $('.alert-box');                  $box.html('<span>error: </span>' + data.error);                  $box.show();                  var box_left = ($(window).width() -  $box.width()) / 2;                  for(var i=1; 4>=i; i++){                      $box.animate({left:-(40-10*i)},50);                      $box.animate({left:+2*(40-10*i)},50);                  }
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn