ここでhttp://dev.arphilvolis.fr/ Lire avi des professionnels on Lire la suiteをクリックしてください。divを展開し、別のクリックでdivを折り畳む必要があります。jQueryを使用してdivを展開して折りたたむ
私のHTML構造:
<p style="text-align: left;">some content here</p>
<p style="text-align: left;">some content here</p>
<span class="collapslink">Lire la suite</span>
<div class="collapscontent">
<p style="text-align: left;">content</p>
<p style="text-align: left;">content</p>
</div>
私のjQueryコード:
jQuery(".collapslink").click(function() {
$collapslink = $(this);
//getting the next element
$collapscontent = $collapslink.next();
//open up the content needed - toggle the slide- if visible, slide up, if not slidedown.
$collapscontent.slideToggle(500, function() {
//execute this after slideToggle is done
//change text of header based on visibility of content div
$collapslink.text(function() {
//change text based on condition
return $collapscontent.is(":visible") ? "Fermer" : "Lire la suite";
});
});
});
JSFiddle http://jsfiddle.net/94150148/vfcau364/20/が動作しますが、私のウェブサイトにしないことです。http://dev.arphilvolis.fr/
あなたのウェブサイト上の「L'avis des professionnels」というテキストはクリック可能なリンクではありません。 – Utkanos
@Utkanosはい、それは正常です。 – Laurent
すべてのjsプラグインを削除し、メインのみを追加してみてください。また、あなたのクリック機能の中で jQuery( "。collapslink")。クリック(function(){ イベントリスナーブレークポイントを使用すると、コンソールログを追加してもその機能には入っていないようです。 – Stephen