.SlideDown 不适用于附加的 Html
.SlideDown not working on appended Html
在附加div
时,我似乎无法使slideDown
效果起作用。HTML 和 jQuery 如下。
任何建议都会有很大帮助。谢谢!
.HTML
<div class="pin">
<div class="top-pin">
<img class="icon-pic" src="img/nautica.gif" />
<p class= "pin-title">Nautica</p>
</div>
<img class="pin-pic" src="img/shoes.jpg" />
<div class="pin-comment">
<img class="small-icon-pic" src="img/Calvin_pic.png" />
<p class="pin-comment-text">Can't go wrong with classic sperrys. #topsiders</p>
</div>
</div>
.JS
var hiddenComments = "<div class='hidden-comment'><img class='small-icon-pic' src='img/Calvin_pic.png' /><p class='pin-comment-text'>Can't go wrong with classic sperrys. #topsiders</p></div>";
$(".comment-icon").click(function (event) {
$('.pin-comment:last').append(hiddenComments);
$('.pin-comment').find('.new-comment:last').slideDown('slow');
$(this).parent().find(".comment-hidden").slideDown();
$(this).parent().find(".comment-count").hide();
});
也许您需要将动画作为其他动画的回调包含在内,因为我记得动画会停止其他动画
试试这个
$(".comment-icon").click(function (event) {
$('.pin-comment:last').append(hiddenComments);
$('.pin-comment').find('.new-comment:last').slideDown('slow', function(){
$(this).parent().find(".comment-hidden").slideDown( function(){
$(this).parent().find(".comment-count").hide();
);
);
});
也许你需要重新排列jQuery这个选择器
相关文章:
- 通过jQuery插入HTML不起作用
- ng绑定html不工作
- Html不是'我没认出Angularjs吐出来的标签
- HTML不是'删除数据项时未更改
- html不会在部分视图中呈现
- HTML 不加载 CSS ,刷新后一切正常.同样在移动设备上,它在首次加载时不起作用
- CSS 类在特定场景中不适用
- .html不是reqwest.js库的函数
- ng类不适用
- 当.js和.html不在同一文件夹中时,如何在Aurelia中创建自定义元素
- Internet Explorer CSS类样式没有'如果存在具有相同类名的其他元素,则不适用
- 跨域AJAX请求返回HTML(不是jsonp)
- 选择标记的内部 HTML 不会更新所选选项
- JSP if() 语句中的 HTML 不起作用
- AngularJs ng-include src =“sample.html ” 不起作用
- 在Grails模板中呈现的HTML不会附加到页面源代码(DOM)
- 为什么这个 HTML 不会打印
- 为什么来自验证的 html 不起作用
- CSS宽度不'通过.html()克隆html代码时不适用
- 锚html ()只适用于右击,而不是左击