Tom*_*kay 3 html jquery image galleria
这是我的HTML(即时通讯使用Galleria图库 - 基于JQuery)
<div id="galleria">
<img alt="Productname 1" src="bens_img/1.jpg">
<img alt="Productname 2" src="bens_img/2.jpg">
<img alt="Productname 3" src="bens_img/3.jpg">
<img alt="Guess what?" src="bens_img/4.jpg">
</div>
Run Code Online (Sandbox Code Playgroud)
伪代码
Get string from <alt> from <img>
Create a new <li> and paste the <alt> string from <img> in it
Run Code Online (Sandbox Code Playgroud)
这应该用所有(即:四个)img alt字符串完成.它应该如下所示:
<ul class="textformat">
<li>Productname 1</li>
<li>Productname 2</li>
<li>Productname 3</li>
<li>Guess what?</li>
</ul> <!-- yeah this was all done by java-script -->
Run Code Online (Sandbox Code Playgroud)
像这样:
$("#galleria > img").each(function(i, ele) {
$(".textformat").append("<li>"+$(ele).attr("alt")+"</li>");
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8537 次 |
| 最近记录: |