Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: jquery Help

  1. #1
    Regular Coder
    Join Date
    Dec 2010
    Posts
    414
    Thanks
    22
    Thanked 55 Times in 55 Posts

    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);
    });
    });

  • #2
    Regular Coder
    Join Date
    Dec 2010
    Posts
    414
    Thanks
    22
    Thanked 55 Times in 55 Posts
    You may see the view more links here http://stage.1cp.ca/abc130fce8e3?page=2

  • #3
    Regular Coder
    Join Date
    Dec 2010
    Posts
    414
    Thanks
    22
    Thanked 55 Times in 55 Posts
    Any help guys ?


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •