Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 10 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
您可能想首先创建您想要的 html。
因此,先有一张图像,然后是三张图像,然后是五张图像,这样就有了三个文件。
然后,您将考虑使用 javascript 执行此操作,但您可以首先确保您的 css 正确以及您正在寻找的内容。
这样,当您从 javascript 创建它时,您可以将您想要的内容与生成的内容进行比较。
如前所述,jQuery 是一个优秀的库,但是,对于您想要做的事情来说,它可能有点多,除非除了创建页面之外您还有其他要求。
例如,如何将数据获取到页面,以便它知道要生成什么?
如果您正在进行 ajax 调用,这将是另一个要求。
您是否期望当他们将鼠标悬停在图像上或单击图像时会发生任何事情,这对于每个图像都是唯一的(例如它将是缩略图,鼠标悬停它会变得更大一点)?那将是另一个要求。
如果您只想创建页面,那么只需使用纯 javascript 即可,因为它会很简单,并且要熟练使用 jQuery,您仍然应该学习 javascript。
更新:我注意到一个很好的评论,通过生成我假设你只会创建一个
标签,如果你动态生成图像那么你不会如果能够在 html 中做到这一点,您最终将使用
标记,那么问题是必须在哪些版本的 IE 上运行。
You may want to start by creating the html that you want, first.
So, have one image, then three then five, so you have three files.
Then, you will be looking at doing this with javascript, but you can first make certain that your css is correct, and what you are looking for.
That way, when you create it from javascript you can compare what you want with what you generated.
As mentioned, jQuery is an excellent library, but, for what you want to do it may be a bit much, unless there is other requirements you have besides just creating the page.
How will you get the data, for example, to the page, so it knows what to generate?
If you are making an ajax call, that will be another requirement.
Do you expect anything to happen when they mouseover an image, or click on an image, that will be unique for each image (such as it will be a thumbnail, mouseover it gets a little bigger)? That would be another requirement.
If all you want to do is create the page, then just do it in plain javascript, as it will be simple, and to get good with jQuery you should still learn javascript.
UPDATE: I noticed an excellent comment, by generate I was assuming you would just create an
<img>
tag, if you are dynamically generating the image then you won't be able to do that in html, you will end up using the<canvas>
tag, then the issue is which versions of IE must this work on.