Ho inserito la funzione "leggi tutto" attraverso questi due script:
primo script:
codice HTML:
(function($) {
$.fn.textExcerpt = function(options) {
var settings = $.extend({}, $.fn.textExcerpt.defaults, options);
return this.each(function() {
var $container = $(this);
var fullText = $container.text();
var fullTextLength = fullText.length;
var excerpt = fullText.substring(0, settings.excerptLength);
var showMoreText = fullText.substring(settings.excerptLength).trim();
if (fullTextLength > settings.excerptLength) {
$container.html(excerpt + ('<span class="tl_dot">...</span><span class="tl_show_more_text">' + showMoreText + '</span>'));
$('<br /><span class="tl_show_more">' + settings.revealLabel + '</span>')
.appendTo($container)
.toggle(function() {
$container.find('span.tl_show_more_text').show();
$(this).text(' ' + settings.hideLabel);
}, function() {
$container.find('span.tl_dot').show();
$container.find('span.tl_show_more_text').hide();
$(this).text(settings.revealLabel);
});
$container.find('span.tl_show_more_text').hide();
}
});
};
$.fn.textExcerpt.defaults = {
excerptLength: 450,
revealLabel: "Show More",
hideLabel: "Show Less"
};
})( jQuery );
secondo script:
codice HTML:
$(function() {
$('.descrizione').textExcerpt({
excerptLength: 450,
revealLabel: "leggi tutto",
hideLabel: "riduci"
});
});
Il contenuto della descrizione viene estratto dinamicamente da database e tutto quello che rientra nella classe ".descrizione" non viene interpretato correttamente. Infatti se inserisco tag html questi non vengono considerati e il testo non formattato e credo che questo sia imputabile al primo script.
Qualcuno ha idea perchè?
Potreste darmi una mano?