JQuery 追加图片
JQuery append image
我正在尝试将缩略图图像移动到摘要标题下方。这是我的代码。目前没有任何反应。有什么建议么?谢谢!
JQuery
$(".summary-thumbnail-image" ).insertBefore( ".summary-excerpt" );
HTML
<div class="summary-item">
<a href="/blog/gathering" class="summary-thumbnail-container">
<div class="summary-thumbnail">
<img src="gathering.jpg" class="summary-thumbnail-image">
</div>
</a>
<div class="summary-title">...</div>
<div class="summary-excerpt">...</div></div>
尝试添加 .html()
:
$(".summary-thumbnail-image" ).html().insertBefore( ".summary-excerpt" );
你可以试试
$(document).ready(function(){
$('.summary-item').each(function(){
var ThisIt = $(this);
ThisIt.find('.summary-thumbnail-container').insertAfter(ThisIt.find('.summary-title'));
});
});
我正在尝试将缩略图图像移动到摘要标题下方。这是我的代码。目前没有任何反应。有什么建议么?谢谢!
JQuery
$(".summary-thumbnail-image" ).insertBefore( ".summary-excerpt" );
HTML
<div class="summary-item">
<a href="/blog/gathering" class="summary-thumbnail-container">
<div class="summary-thumbnail">
<img src="gathering.jpg" class="summary-thumbnail-image">
</div>
</a>
<div class="summary-title">...</div>
<div class="summary-excerpt">...</div></div>
尝试添加 .html()
:
$(".summary-thumbnail-image" ).html().insertBefore( ".summary-excerpt" );
你可以试试
$(document).ready(function(){
$('.summary-item').each(function(){
var ThisIt = $(this);
ThisIt.find('.summary-thumbnail-container').insertAfter(ThisIt.find('.summary-title'));
});
});