Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-08-2012, 05:00 PM   PM User | #1
aaronhockey_09
Regular Coder

 
Join Date: Dec 2010
Posts: 411
Thanks: 21
Thanked 55 Times in 55 Posts
aaronhockey_09 is an unknown quantity at this point
Thumbs down jquery Help

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);
});
});
aaronhockey_09 is offline   Reply With Quote
Old 05-08-2012, 05:01 PM   PM User | #2
aaronhockey_09
Regular Coder

 
Join Date: Dec 2010
Posts: 411
Thanks: 21
Thanked 55 Times in 55 Posts
aaronhockey_09 is an unknown quantity at this point
You may see the view more links here http://stage.1cp.ca/abc130fce8e3?page=2
aaronhockey_09 is offline   Reply With Quote
Old 05-08-2012, 08:33 PM   PM User | #3
aaronhockey_09
Regular Coder

 
Join Date: Dec 2010
Posts: 411
Thanks: 21
Thanked 55 Times in 55 Posts
aaronhockey_09 is an unknown quantity at this point
Any help guys ?
aaronhockey_09 is offline   Reply With Quote
Reply

Bookmarks

Tags
bigger, button, height, jquery, view

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:52 AM.


Advertisement
Log in to turn off these ads.