【问题标题】:Apply Styling automatically after upload上传后自动应用样式
【发布时间】:2013-09-17 05:34:44
【问题描述】:

谁能指出我正确的方向。我有一个使用 jquery 和 fancybox 的网页,其中图像以精美的宝丽来风格等显示。

Fiddle

我怎样才能使使用 html5 文件 APi 添加/上传的新照片将自身放入 div 并应用必要的样式。下面是我需要添加图像的 div。因此,如果我上传 100 张图片,它们在上传后都会自动具有相同的样式。谢谢

<div id="view3">
   <div id="polaroid"> <!--class for styling-->
<!--Image One-->
    <figure><a class="fancybox" title="Image-1" href="images/1.png"><img src="images/1.png" width="250" height="200" alt="" /></a> <!--the image-->
<textarea>Image-1</textarea> <!--the caption that appears below the image-->
</figure>

【问题讨论】:

  • 代码运行良好是什么问题?

标签: jquery css html file-upload


【解决方案1】:

您是否已经有上传处理程序并且只想知道如何添加文件?在这种情况下,您可以执行以下操作:

var parent = $("#polaroid"), 
img =  "<figure><a class='fancybox' title='Image-1' href='images/" + yourFile + "'><img   src='" + yourFile + "' width='250' height='200' alt='' /></a>";
parent.append(img);

【讨论】:

  • 太棒了,是的,我正在使用 html5 事件处理程序。 &lt;input type="file" id="file"/&gt; 我假设我需要的不仅仅是 javascript 和通风处理程序,图像实际上是如何放到画布上的?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-04
  • 2012-06-06
  • 1970-01-01
  • 1970-01-01
  • 2015-04-09
  • 1970-01-01
相关资源
最近更新 更多