こんにちは私はdjangoとjqueryエクスパンダープラグインhttp://plugins.learningjquery.com/expander/を使用しています。デフォルトの例を使用すると、すべてが正しく機能します。しかし、データベースデータで使用しようとすると、機能しません。データがレンダリングされる前にスクリプトが実行される可能性はありますか?これを正しくするための提案はありますか?
編集
わかりました、問題が見つかりました。linebreakfilterは、複数のpタグと多数のbrタグを生成します。
js:
$(document).ready(function() {
$('div.expandable p').expander({
slicePoint: 50, // default is 100
expandPrefix: ' ', // default is '... '
expandText: 'show more', // default is 'read more'
userCollapseText: 'show less' // default is 'read less'
});
});
htmlの動作:
<div class="expandable">
<p>ljddf adfsdf esaf nmnj asdf adsfsdafsdf</p>
</div>
htmlの動作:
<div class="expandable">
<p>{{ object.description }}</p>
</div>