jQuery 将图像附加到 div 不显示,但可以在 Firebug 上看到它

发布于 2024-12-22 09:19:59 字数 377 浏览 3 评论 0原文

我有这个设计应用程序,它允许用户使用 jQuery 在 div 上动态添加文本(追加)。文本是使用 ImageMagick 生成的(因此它有一些效果,如曲线、波浪等。)并且它是 png 格式。

我的问题是,每当我尝试处理图像并将其 jQuery“有时”附加到 html div 时,它都不会显示,但是当使用 firebug 检查时,我可以看到元素/图像就在那里。我猜这是关于生成图像时互联网连接的“延迟”。

有没有办法“预加载”或确保在将图像附加到 div 之前创建图像?

该图像是通过 jQuery 使用“shell_exec(“imagemagick command”)”发布到“php”文件创建的,并且我已经在发布完成时添加了一个回调(追加发生在此处)。

谢谢 (”,)

I have this design application which allows users to dynamically add text(append) on a div using jQuery. The text is generated using ImageMagick(so it has some effects like curve,wave, etc..) and it is in png format.

My problem is that whenever I try to process the image and jQuery-append it to the html div "sometimes" it wont show up, but when checking with firebug I can see that the element/image is there. I'm guessing this is about "delay" in internet connection while generating image.

Is there a way to "preload" or make sure that the image is created before it is appended to the div ?

The image is created via jQuery post to a "php" file with "shell_exec("imagemagick command")" and I've already added a callback when the post is finished(the append happens here).

Thanks (",)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绅士风度i 2024-12-29 09:19:59
$(".appender").click(function() {
   $(".appendingDiv").append($('<img />').attr('src', 'http://imagesrc.com'));
})
$(".appender").click(function() {
   $(".appendingDiv").append($('<img />').attr('src', 'http://imagesrc.com'));
})
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文