Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How to animate truncated text

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #161274

    I’m using the jQuery dotdotdot 1.6.12 plugin to add an ellipsis to truncated text. You can see it on this page by clicking any of the ‘EN SAVOIR PLUS’ buttons under ‘COMPÉTENCES’ http://debourg-dev.ch/crea/

    I use the below code to add the ellipsis:
    $(“.truncate-text”).dotdotdot();

    $(".truncate-wrap article").click(function(event) {
    
        event.preventDefault();
    
            if ($(this).hasClass("truncated")) {
    
                $(this).removeClass("truncated");
                $(this).find(".truncate-text").trigger("destroy");
                $(this).find(".truncate-text").css({'height': 'auto', 'margin-bottom': '0'});
                $(this).find(".truncate").hide();
    
            } else {
    
                $(this).addClass("truncated");
                $(this).find(".truncate-text").css({'height': '80px', 'margin-bottom': '20px'});
                $(this).find(".truncate-text").dotdotdot();
                $(this).find(".truncate").show();
    
            }
    
    });
    

    How can I animate the transition to slide up/down (like a jquery toggle for example) when the full text is shown/truncated?

    Thanks

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.