soupig
<!DOCTYPE html>
<html>
<head>
    <title>大图片加载从模糊到清晰</title>
</head>
<body style="text-align:center">
    <h3>大图片加载从模糊到清晰</h3>
    <div class="mark" style=\'background-image:url(http://img.neweb.top/20181110.jpg);background-size:100%;
        filter: blur(4px);transition: all 0.7s;width: 800px;height: 450px;margin-left: 350px;\'>
    </div>
    <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
    <script type="text/javascript">
        // 为了看到效果加个延时
        setTimeout(function(){
            // 若图片URL失效请自行替换
            var imgUrl = \'http://img.neweb.top/20181110.jpg\';
            var imgObject = new Image();

            imgObject.src = imgUrl;
            imgObject.onload = function(){
               $(\'.mark\').css({
                    backgroundImage: \'url(\'+imgUrl+\')\',
                    filter: \'blur(0)\'
                });
            }
        }, 1000)
        
    </script>
</body>
</html>

  

分类:

技术点:

相关文章:

  • 2021-06-06
  • 2021-08-07
  • 2022-12-23
  • 2022-12-23
  • 2021-09-05
  • 2020-10-13
  • 2021-12-04
猜你喜欢
  • 2022-12-23
  • 2021-06-18
  • 2021-09-11
  • 2021-10-23
  • 2021-11-23
  • 2021-12-27
相关资源
相似解决方案