How to create a “show more” button and specify how many lines of text can be initially shown

后端 未结 3 569
青春惊慌失措
青春惊慌失措 2020-12-04 18:08

I\'m looking for a way to create a slide out \'show more\' feature on my responsive site, which cuts off after two lines of a paragraph.

I\'ve achie

3条回答
  •  我在风中等你
    2020-12-04 18:58

    My suggestion to solve the problem

    $("#slider_desc_toogler").on( "click", function() { 
      $('#slider_desc_toogler > i').toggleClass('fa-arrow-circle-down')
      $('#slider_desc_toogler > i').toggleClass('fa-arrow-circle-up')
      if ($("#slider_desc_toogler > i").hasClass( "fa-arrow-circle-down" )) {
        $(".slider_desc").css("max-height","38px");
      } else $(".slider_desc").css("max-height","500px");
    });
    .slider_desc {
      margin: 16px;
      margin-top: 0px;
      color: #333333;
      font-family: Arial;
      font-size: 14px;
      line-height: 18px;
      text-align: justify;
      overflow: hidden;
      transition: all 0.5s ease 0s;
      max-height: 38px;
    }
    
    #slider_desc_toogler{
      border-top: silver 1px dotted;
      margin-bottom: 30px;
      margin-top: 20px;
      width: 70%;
      margin-left: auto;
      margin-right: auto;
    }
    
    #slider_desc_toogler i {
          position: absolute;
          text-align: center;
          color: silver;
          font-size: 25px;
          font-family: fontawesome;
          left: calc(50% - 10px);
          margin-top: -13px;
          background: #fff;
      }
    
    
    
    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

提交回复
热议问题