zoukankan      html  css  js  c++  java
  • 根据标签内个数,显示隐藏《加载更多》

    <div class="question inner">
      <div class="title"><span><i class="line-l"></i>大标题<i class="line-r"></i></span></div>
      <ul class="clearFix">
        <li>
          <h3>标题1</h3>
          <span class="test1"></span>
          <a href="###">内容1</a>
          <a href="###">内容1</a>
          <a href="###">内容1</a>
          <a href="###">内容1</a>
          <a href="###">内容1</a>
          <a class="test1" href="#">  了解更多 >></a>
        </li>

        <li>
          <h3>标题2</h3>
          <span class="test2"></span>
          <a href="###">内容1</a>
          <a href="###">内容1</a>
          <a href="###">内容1</a>
          <a href="###">内容1</a>
          <a href="###">内容1</a>
          <a class="test2" href="#">  了解更多 >></a>
        </li>
      </ul>
      <a href="{:cate(18,info)}" class="more">更多问题解答</a>
    </div>

    </body>
    <script>
      $(function(){
        function foo(test){
          var leng = $("."+test+"").eq(0).nextUntil($("."+test+"").eq(1));//获取到两个标签的位置计算长度,根据长度显示
          if(leng.length < 5 ){
            $("."+test+"").eq(1).hide()
          }else{
            $("."+test+"").eq(1).show()
          }
        }
      foo("test1")
      foo("test2")
    })
    </script>

  • 相关阅读:
    Flask——session
    UISB ScrollView
    UISB 登陆
    UISB TextField
    UISB 进步器 分栏控制器
    UISB UISlider ProgressView
    UISB Switch
    UISB 定时器
    Django-Celery文档
    UISB UIViewController
  • 原文地址:https://www.cnblogs.com/wangxuanvip/p/10515570.html
Copyright © 2011-2022 走看看