【问题标题】:How to detect when -webkit-mask-box-image has downloaded如何检测 -webkit-mask-box-image 何时下载
【发布时间】:2012-07-11 09:17:53
【问题描述】:

我以编程方式在 Web 服务器上生成掩码图像,然后使用以下代码将其应用于 HTML 元素:

imageToMask.style["-webkit-mask-box-image"] = "url('" + featherURL +"') 100 stretch";

我怎样才能知道图像何时返回并完成下载,以便它不只是弹出到页面上?

【问题讨论】:

    标签: javascript html css-mask


    【解决方案1】:

    您可能可以做一些类似于@lonesomeday 所做的事情:

    jQuery .on() not bound when script inserted into the DOM

    类似的东西:

     $('button').click(function() {
         var imageToMask = document.createElement('img');
         imageToMask.style["-webkit-mask-box-image"] = "url('" + featherURL +"') 100 stretch";
    
         imageToMask.onload = function() {
            //Custom behaviour
         };
         document.body.appendChild(imageToMask);
     });
    

    【讨论】:

      猜你喜欢
      • 2013-09-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-17
      • 2013-11-05
      • 2018-04-25
      • 2011-08-17
      相关资源
      最近更新 更多