Utilisation de la jQuery dotdotdot plugin, je voudrais avoir à la fois un Voici mon code : p> Il semble que le Solution Trouvé: strong> p> Code mis à jour : P> merci, gars! p> p> 3 Réponses : Modifier ceci: à ceci: p> La deuxième manière consiste à utiliser une balise simple La réponse d'Ehsan Sajjad est correcte, mais vous avez également un bogue que vous commencez avec un bouton de plus et moins, mais renommez le bouton moins pour pouvoir le masquer. J'ai modifié le JS sur le violon et il semble maintenant fonctionner correctement.
Oui, j'ai vu cela aussi, mais je ne peux pas comprendre ce qui est arrivé à mon PC que je peux enregistrer et mettre à jour tout violon, problème est à jour et bouton de sauvegarde ne sont pas visisibles sur mon PC
@Ehsansajjad 90% sûr que c'est la solution de votre problème: N'utilisez pas Internet Explorer;) Je suis un peu en retard à cette fête mais je pensais que vous pourriez profiter de ce code. Aussi sur Jsfiddle. net / fo4z05qp p> p> cliquez sur CODE> Gestionnaire d'événements pour le
votes
code mis à jour: h2>
HTML: H2>
$(function () {
$("div.ellipsis-text").dotdotdot({
after: 'a.more',
callback: dotdotdotCallback
});
$("div.ellipsis-text").on('click', 'a', function () {
if ($(this).text() == "More") {
var div = $(this).closest('div.ellipsis-text');
div.trigger('destroy')
div.css('max-height', '');
$(this).text("Less");
} else {
$(this).text("More")
$(this).closest('div.ellipsis-text').css("max-height", "50px").dotdotdot({
after: "a",
callback: dotdotdotCallback
});
}
});
function dotdotdotCallback(isTruncated, originalContent) {
if (!isTruncated) {
$("a", this).remove();
}
}
});
votes
$(function() {
$("div.ellipsis-text").dotdotdot({
after: 'a.more',
callback: dotdotdotCallback
});
$("div.ellipsis-text").on('click','a',function() {
if ($(this).text() == "More") {
var div = $(this).closest('div.ellipsis-text');
div.trigger('destroy').find('a.more').hide();
div.css('max-height', '');
$("a.less", div).show();
}
else {
$(this).hide();
$(this).closest('div.ellipsis-text').css("max-height", "50px").dotdotdot({ after: "a.more", callback: dotdotdotCallback });
}
});
function dotdotdotCallback(isTruncated, originalContent) {
if (!isTruncated) {
$("a", this).remove();
}
}
});
votes
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://rawgit.com/BeSite/jQuery.dotdotdot/master/src/js/jquery.dotdotdot.min.js"></script>
<p class="truncable-txt">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
<span class="read-more trigger-js"> <a class="read-more__txt">more</a></span>
<span class="read-less trigger-js"> <a class="read-less__txt">less</a></span>
</p>
<p class="truncable-txt">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
<span class="read-more trigger-js"> <a class="read-more__txt">more</a></span>
<span class="read-less trigger-js"> <a class="read-less__txt">less</a></span>
</p>
Dupliqué possible de jQuery dotdotdot développer tronquacer le texte onclick