欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery實(shí)現(xiàn)導(dǎo)航樣式布局操作示例【可自定義樣式布局】

 更新時(shí)間:2018年07月24日 11:20:35   作者:金含  
這篇文章主要介紹了jQuery實(shí)現(xiàn)導(dǎo)航樣式布局操作,可實(shí)現(xiàn)基于jQuery的用戶自定義樣式布局與屬性動(dòng)態(tài)操作相關(guān)技巧,需要的朋友可以參考下

本文實(shí)例講述了jQuery實(shí)現(xiàn)導(dǎo)航樣式布局操作。分享給大家供大家參考,具體如下:

1. 導(dǎo)航Html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>www.dbjr.com.cn 導(dǎo)航樣式布局</title>
  <link rel="stylesheet" href="style.css" rel="external nofollow" >
  <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
  <script src="nav.js"></script>
  <script>
    $(function () {
      $('.list').eq(0).nav('yellow','19px');
    })
  </script>
</head>
<body>
<ul class="list">
  <li>導(dǎo)航列表
    <ul class="nav">
      <li>導(dǎo)航列表1</li>
      <li>導(dǎo)航列表1</li>
      <li>導(dǎo)航列表1</li>
      <li>導(dǎo)航列表1</li>
      <li>導(dǎo)航列表1</li>
    </ul>
  </li>
  <li>導(dǎo)航列表
    <ul class="nav">
      <li>導(dǎo)航列表2</li>
      <li>導(dǎo)航列表2</li>
      <li>導(dǎo)航列表2</li>
      <li>導(dǎo)航列表2</li>
      <li>導(dǎo)航列表2</li>
    </ul>
  </li>
  <li>導(dǎo)航列表
    <ul class="nav">
      <li>導(dǎo)航列表3</li>
      <li>導(dǎo)航列表3</li>
      <li>導(dǎo)航列表3</li>
      <li>導(dǎo)航列表3</li>
      <li>導(dǎo)航列表3</li>
    </ul>
  </li>
  <li>導(dǎo)航列表
    <ul class="nav">
      <li>導(dǎo)航列表4</li>
      <li>導(dǎo)航列表4</li>
      <li>導(dǎo)航列表4</li>
      <li>導(dǎo)航列表4</li>
      <li>導(dǎo)航列表4</li>
    </ul>
  </li>
  <li>導(dǎo)航列表
    <ul class="nav">
      <li>導(dǎo)航列表5</li>
      <li>導(dǎo)航列表5</li>
      <li>導(dǎo)航列表5</li>
      <li>導(dǎo)航列表5</li>
      <li>導(dǎo)航列表5</li>
    </ul>
  </li>
</ul>
</body>
</html>

2. 導(dǎo)航css布局代碼

@charset "utf-8";
body{
  margin: 0;
}
.list{
  list-style-type:none;
  margin: 0;
  padding: 0;
  font-size: 14px;
  color: #fff;
  width: 500px;
  margin:50px auto;
}
.list li{
  float: left;
  width: 100px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  background-color: #333333;
  cursor: pointer;
}
.nav{
  /*list-style:none;*/
  margin:0;
  padding:0;
  display:none;
/*color:color ;*/
  /*background-color: ;*/
}

3. 導(dǎo)航j(luò)s自定義布局代碼

/**
 * Created by Administrator on 2016/5/23.
 */
;(function ($) {
  $.fn.extend(
    {
     'nav':function (color,fonts) {
     $(this).find('.nav').css({
          'list-style':'none',
          'margin':0,
          'padding':0,
          'display':'none',
          'color':color,
          'font-size':fonts
        });
        $(this).find('.nav').parent('li').hover(function () {
          $(this).find('.nav').slideDown('normal');
        },function () {
          $(this).find('.nav').stop().slideUp('normal');
        })
        return this;
      }
    }
  );
})(jQuery);

使用在線HTML/CSS/JavaScript代碼運(yùn)行工具http://tools.jb51.net/code/HtmlJsRun測(cè)試,效果如下:

更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jQuery切換特效與技巧總結(jié)》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery常用插件及用法總結(jié)》、《jQuery拖拽特效與技巧總結(jié)》、《jQuery常見(jiàn)經(jīng)典特效匯總》、《jQuery動(dòng)畫(huà)與特效用法總結(jié)》及《jquery選擇器用法總結(jié)

希望本文所述對(duì)大家jQuery程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論