zoukankan      html  css  js  c++  java
  • jquery <li>标签 隔若干行 加空白或者加虚线


    $(function () {


    $('ul li').addClass(function (i) { return i % 6 == 5 ? "ab" : ""; }); // 隔6行 加空白。或者加虚线

    $('.imglist li').after(function (i) {
    var css = "";
    if (i % 3 == 2) {
    css = "<div class='dashed clear' ></div>";
    }
    return css;
    }); //图片列表photo.html 隔3行 虚线

    
    


    });

     

    i 是 <li>的索引号,从0开始

    图片隔三行加虚线,最后一行去掉虚线,还可以这样

        //方法一:
        jQuery(document).ready(function () {
            var NewUL = jQuery(".photo_list ul li");
            for (var i = 0; i < NewUL.length; i++) {
                if ((i + 1) % 3 == 0) {
                    NewUL.eq(i).after("<li class="photo_space"></li>");
                }
            }
            $(".photo_list li:last").css("border-bottom", "none");
        })
        
    .ab
    
    {
    
      height:80px;
    
    }
    .dashed{border-bottom:1px dashed #b9c3c7;padding-bottom:10px;margin-bottom:10px}
    .clear{clear:both}
    .imglist ul li {text-align:center;line-height:25px;float:left}

     

  • 相关阅读:
    GUI编程
    Markdown学习
    [python3]正则表达式
    python3_json&pickle
    python3_module_sys
    python3_module_os
    Python3_module_random
    Pyhton3_module_time()
    Python3 正则表达式 Regular Expression
    Python循环对象
  • 原文地址:https://www.cnblogs.com/qigege/p/4766242.html
Copyright © 2011-2022 走看看