使用 jQuery 自动将 REL 属性应用到帖子
已编辑:我的意思是分组为同一帖子中的所有IMG
提供相同的REL
属性,但每个帖子都有不同的< code>REL 作为本问题末尾的示例。
因此,我需要执行以下操作:
<div id="Blog1" class="widget Blog">
<div class="blog-posts hfeed">
<div class="post hentry uncustomized-post-template">
<a name="8829400899632947948"/>
<div class="post-body entry-content">
<div id="8829400899632947948">
<div class="separator">
<a imageanchor="1" href="/images/outta.png">
<img src="/images/outta.png"/></a></div></div>
<div style="clear: both;"/>
</div>
<div class="post-footer">
</div></div></div></div>
我正在使用 jQuery 和 Colorbox。前两个 DIV
是帖子容器。我需要使用 REL
属性对每个
中的 IMG
进行分组, 喜欢:1 - 帖子
1.1 - IMG - REL="group0"
1.2 - IMG - REL="group0"
1.3 - IMG - REL="group0"
1.4 - IMG - REL="group0"
2 - 帖子
2.1 - IMG - REL="group1"
3 - 帖子
3.1 - IMG - REL="group2"
3.2 - IMG - REL="group2"
我已经尝试过HAS
,PARENT >来自 jQuery 的 CHILDREN
和 CHILDREN()
以及来自 Colorbox 的 REL:
,但似乎我缺乏逻辑上的某个地方。
有人可以帮助我吗?
Edited: I mean grouping as giving the same REL
attibute to all IMG
s in the same post, but each post has different REL
as the example at the end of this question.
So, I need to do the following:
<div id="Blog1" class="widget Blog">
<div class="blog-posts hfeed">
<div class="post hentry uncustomized-post-template">
<a name="8829400899632947948"/>
<div class="post-body entry-content">
<div id="8829400899632947948">
<div class="separator">
<a imageanchor="1" href="/images/outta.png">
<img src="/images/outta.png"/></a></div></div>
<div style="clear: both;"/>
</div>
<div class="post-footer">
</div></div></div></div>
I'm using jQuery and Colorbox. The first two DIV
s are posts containers. I need to group the IMG
s in each <div class="post hentry uncustomized-post-template">
using the REL
attribute, like:
1 - Post
1.1 - IMG - REL="group0"
1.2 - IMG - REL="group0"
1.3 - IMG - REL="group0"
1.4 - IMG - REL="group0"
2 - Post
2.1 - IMG - REL="group1"
3 - Post
3.1 - IMG - REL="group2"
3.2 - IMG - REL="group2"
I've tryied HAS
, PARENT > CHILDREN
and CHILDREN()
from jQuery and REL:
from Colorbox, but it seems I'm lacking somewhere in logic.
Could someone help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你是这个意思吗?
编辑:添加一些评论,希望这对 jquery 新手有所帮助
is this what you mean?
edit: add some comments, hope this help those new with jquery