Jquery Twitter Javascript插件“;“引导”;
我刚刚掌握了隐藏和显示的基本知识 这是一个工作示例代码:Jquery Twitter Javascript插件“;“引导”;,jquery,jquery-plugins,twitter-bootstrap,Jquery,Jquery Plugins,Twitter Bootstrap,我刚刚掌握了隐藏和显示的基本知识 这是一个工作示例代码: <div id="content" class="collapse" > //Place content in here </div> <a href="content" data-toggle="collapse" style="cursor:pointer;">Read More</a> 我不明白的部分是什么是“菌落”?这是缩小的div id吗?使用它是正确的 $('#content'
<div id="content" class="collapse" >
//Place content in here
</div>
<a href="content" data-toggle="collapse" style="cursor:pointer;">Read More</a>
我不明白的部分是什么是“菌落”?这是缩小的div id吗?使用它是正确的
$('#content')
而不是使用
$('#myCollapsible')
在您的情况下:)完整的解决方案是:
$( '#content' ).on( 'hidden', function() {
$( 'a[href="' + this.id + '"]' ).html( 'Read More' );
}).on( 'shown', function() {
$( 'a[href="' + this.id + '"]' ).html( 'Read Less' );
});
如果你想要一些通用的东西,你可以用
$('.#content')
替换$('.collapse')
你能添加JSFIDLE作为证明吗?
$( '#content' ).on( 'hidden', function() {
$( 'a[href="' + this.id + '"]' ).html( 'Read More' );
}).on( 'shown', function() {
$( 'a[href="' + this.id + '"]' ).html( 'Read Less' );
});