jquery css3三角形菜單圖片切換代碼



105 418 140



特效描述:jquery css3 三角形菜單 圖片切換,jQuery左側三角形菜單欄,點擊文字圖片切換效果代碼

代碼結構

1. 引入JS

<script type="text/javascript" src="js/jquery.min.js"></script>

2. HTML代碼

<div class="demo">
  <div class="demo__top"></div>
  <div class="demo__light"></div>
  <div class="demo__content">
    <div class="demo__menu page-active-1">
      <div class="demo__menu-item demo__menu-item-1 m--btn js-menuBtn" data-page="1">
        <span class="demo__menu-item-content">1</span>
      </div>
      <div class="demo__menu-item demo__menu-item-2" data-page="2">
        <span class="demo__menu-item-content">2</span>
      </div>
      <div class="demo__menu-item demo__menu-item-3" data-page="3">
        <span class="demo__menu-item-content">3</span>
      </div>
      <div class="demo__menu-item demo__menu-item-4" data-page="4">
        <span class="demo__menu-item-content">4</span>
      </div>
      <div class="demo__menu-item demo__menu-item-5" data-page="5">
        <span class="demo__menu-item-content">5</span>
      </div>
    </div>
    <div class="demo__page demo__page-1 active">
      <h2 class="demo__page-heading">
        BMW i<span class="demo__page-heading-colored">8</span>
      </h2>
      <h3 class="demo__page-subheading">Concept</h3>
      <div class="demo__page-poly"></div>
    </div>
    <div class="demo__page demo__page-2">
      <h2 class="demo__page-heading">Page 2</h2>
      <div class="demo__page-poly"></div>
    </div>
    <div class="demo__page demo__page-3">
      <h2 class="demo__page-heading">Page 3</h2>
      <div class="demo__page-poly"></div>
    </div>
    <div class="demo__page demo__page-4">
      <h2 class="demo__page-heading">Page 4</h2>
      <div class="demo__page-poly"></div>
    </div>
    <div class="demo__page demo__page-5">
      <h2 class="demo__page-heading">Links</h2>
      <a class="demo__page-link" href="#" target="_blank">My Twitter</a>
      <a class="demo__page-link" href="#" target="_blank">My Codepen</a>
      <div class="demo__page-poly"></div>
    </div>
  </div>
</div>
<script type="text/javascript">
$(document).ready(function() {
  var animating = false;
  function menuToggle() {
    $(".demo__page, .demo__menu, .demo__light").toggleClass("menu-active");
    $(".js-menuBtn").toggleClass("m--btn");
    $(document).off("click", ".demo__content", closeNotFocusedMenu);
  };
  function closeNotFocusedMenu(e) {
    if (!$(e.target).closest(".demo__menu").length) {
      menuToggle();
      $(document).off("click", ".demo__content", closeNotFocusedMenu);
    }
  };
  $(document).on("click", ".js-menuBtn", function() {
    if (animating) return;
    menuToggle();
    $(document).on("click", ".demo__content", closeNotFocusedMenu);
  });
  $(document).on("click", ".demo__menu-item:not(.js-menuBtn)", function() {
    animating = true;
    var $this = $(this);
    var page = +$this.data("page");
    $(".js-menuBtn").removeClass("js-menuBtn");
    $(".demo__page.active").removeClass("active");
    $this.addClass("js-menuBtn m--btn");
    $(".demo__page-" + page).addClass("active");
    $(".demo__page, .demo__menu, .demo__light").removeClass("menu-active");
    $(document).off("click", ".demo__content", closeNotFocusedMenu);
    setTimeout(function() {
      $(".demo__menu")[0].className = $(".demo__menu")[0].className.replace(/\bpage-active-.*\b/gi, "");
      $(".demo__menu").addClass("page-active-" + page);
      animating = false;
    }, 1000);
  });
});
</script>



用戶評論
大牛,別默默的看了,快登錄幫我點評一下吧!:)      登錄 | 注冊


熱門標簽: flash導航菜單 flash導航條 flash導航 flash菜單 flash下拉菜單 flash下拉導航菜單 滑動導航菜單 滑動導航 滑動菜單 滾動導航菜單 滾動菜單 滾動導航 導航切換 菜單切換 右鍵菜單 收縮菜單 收縮導航 h5動畫導航 h5動畫菜單 html5動畫導航 html5動畫菜單 浮動菜單 浮動導航 滾動切換 滾動條切換 滑動選項卡 滑動切換 滑動手風琴 選項卡切換 選項卡 切換 tab切換 頁面切換 選項卡插件 切換插件 收縮展開 展開收縮 收縮 展開 漸隱切換 淡出淡進 淡出 淡進 切換按鈕 表單 表單美化 表單插件 表單美化插件 導航菜單 導航條 菜單欄 導航欄 分類導航 響應式導航條 響應式導航 收縮菜單 收縮導航 圖片淡出淡進 圖片淡出 圖片淡進 二級菜單 二級導航菜單 二級導航 圖片切換 圖片選項卡 圖標選項卡 圖標導航 圖標菜單 按鈕控制
?
×
×

注冊

官方QQ群

掃描上面二維碼加微信群

官方QQ群

jQuery/js討論群
群號:642649996
Css3+Html5討論群
群號:322131262

加群請備注:從官網了解到

老夫子电子