Je reviens sur mon problème toujours pas résolu.
Une idée ?
Ou un autre moyen de déplier/replier un bloc au clic ?
JC
-------- Message transféré --------
Sujet : [Spip] bloc dépliant et pagination
Date : Thu, 12 Sep 2019 10:59:59 +0200
De : Jean-Christophe Villeneuve jcvilleneuve@cegetel.net
Pour : liste SPIP users spip@rezo.net
Bonjour
Dans Escal, j’utilise un script qui permet de déplier ou replier un bloc.
Mais si ce bloc contient une pagination, une fois qu’on a cliqué sur un
lien de pagination, la possibilité de repli disparaît.
Un exemple pour mieux comprendre avec le bloc « dans la même rubrique »
http://escal.ac-lyon.fr/spip/spip.php?article428&lang=fr
http://escal.ac-lyon.fr/spip/spip.php?article428&lang=fr
Si quelqu’un qui comprend le js peut m’aider, merci à lui.
Le code html (simplifié) est celui-ci
<h1>
Dans la même rubrique
</h1>
<div class="toggle" >
<p class="pagination">#PAGINATION</p>
...
Et le javascript est celui-ci
// Andy Langton’s show/hide/mini-accordion - updated 23/11/2009
// Latest version @ http://andylangton.co.uk/jquery-show-hide
// this tells jquery to run the function below once the DOM is ready
$(document).ready(function() {
// choose text for the show/hide link - can contain HTML (e.g. an image)
var showText=’’;
var hideText=’’;
// initialise the visibility check
var is_visible = false;
// append show/hide links to the element directly preceding the element
with a class of « toggle »
$(’.toggle’).prev().append(’ ‹ +showText+ ›’);
// hide all of the elements with a class of ‹ toggle ›
$(’.toggle’).hide();
// capture clicks on the toggle links
$(‹ a.toggleLink ›).click(function() {
// switch visibility
is_visible = !is_visible;
// change the link depending on whether the element is shown or hidden
$(this).html( ($(this).html() == hideText) ? showText : hideText);
// toggle the display - uncomment the next line for a basic « accordion »
style
//$(’.toggle’).hide();$(‹ a.toggleLink ›).html(showText);
$(this).parent().next(’.toggle’).toggle(‹ slow ›);
// return false so any link destination is not followed
return false;
});
});
Portion de message joint (351 Bytes)