Hey guys, so i have a problem here.
I have some view more buttons on comments.
Right now they show up on every comment, but i only want them to show up if the content is more that 60px.
This is what i have, and the part heighlighted in RED is the part that doesnt seem to be working
any help.
Code:
$(function(){
// The height of the content block when it's not expanded
var adjustheight = 60;
// The "more" link text
var moreText = "+ More";
// The "less" link text
var lessText = "- Less";
if ($('.more-less .more-block p').height() < 59)
{
$(".more-less .more-block p").css('height', 'auto');
$(".adjust").css('display', 'none');
}
else if ($('.more-less .more-block p').height() > 59)
{
$(".more-less .more-block p").css('height', adjustheight).css('overflow', 'hidden');
}
// The section added to the bottom of the "more-less" div
$(".more-less").append('<a href="#" class="adjust"></a>');
$("a.adjust").text(moreText);
$(".adjust").toggle(function() {
$(this).parents("div:first").find(".more-block p").css('height', 'auto').css('overflow', 'visible');
// Hide the [...] when expanded
$(this).parents("div:first").find("p.continued").css('display', 'none');
$(this).text(lessText);
}, function() {
$(this).parents("div:first").find(".more-block p").css('height', adjustheight).css('overflow', 'hidden');
$(this).parents("div:first").find("p.continued").css('display', 'none');
$(this).text(moreText);
});
});