$(function () { // 导航切换 jQuery(".nav ul").slide({ type: "menu",// 效果类型,针对菜单/导航而引入的参数(默认slide) titCell: ".nLi", //鼠标触发对象 targetCell: ".sub", //titCell里面包含的要显示/消失的对象 effect: "slideDown", //targetCell下拉效果 delayTime: 300, //效果时间 triggerTime: 0, //鼠标延迟触发时间(默认150) returnDefault: true //鼠标移走后返回默认状态,例如默认频道是“预告片”,鼠标移走后会返回“预告片”(默认false) }); }); // 右侧导航栏 jQuery(document).ready(function ($) { var $lateral_menu_trigger = $('#cd-menu-trigger'), $content_wrapper = $('.cd-main-content'), $navigation = $('.phone'); //open-close lateral menu clicking on the menu icon $lateral_menu_trigger.on('click', function (event) { event.preventDefault(); $lateral_menu_trigger.toggleClass('is-clicked'); $navigation.toggleClass('lateral-menu-is-open'); $content_wrapper.toggleClass('lateral-menu-is-open').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function () { // firefox transitions break when parent overflow is changed, so we need to wait for the end of the trasition to give the body an overflow hidden $('body').toggleClass('overflow-hidden'); }); $('#cd-lateral-nav').toggleClass('lateral-menu-is-open'); //check if transitions are not supported - i.e. in IE9 if ($('html').hasClass('no-csstransitions')) { $('body').toggleClass('overflow-hidden'); } }); //close lateral menu clicking outside the menu itself $content_wrapper.on('click', function (event) { if (!$(event.target).is('#cd-menu-trigger, #cd-menu-trigger span')) { $lateral_menu_trigger.removeClass('is-clicked'); $navigation.removeClass('lateral-menu-is-open'); $content_wrapper.removeClass('lateral-menu-is-open').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function () { $('body').removeClass('overflow-hidden'); }); $('#cd-lateral-nav').removeClass('lateral-menu-is-open'); //check if transitions are not supported if ($('html').hasClass('no-csstransitions')) { $('body').removeClass('overflow-hidden'); } } }); //open (or close) submenu items in the lateral menu. Close all the other open submenu items. $('.item-has-children').children('a').on('click', function (event) { event.preventDefault(); $(this).toggleClass('submenu-open').next('.sub-menu').slideToggle(200).end().parent('.item-has-children').siblings('.item-has-children').children('a').removeClass('submenu-open').next('.sub-menu').slideUp(200); }); }); //下拉菜单 $(function () { var Accordion = function (el, multiple) { this.el = el || {}; this.multiple = multiple || false; // Variables privadas var links = this.el.find('.link'); // Evento links.on('click', { el: this.el, multiple: this.multiple }, this.dropdown) } Accordion.prototype.dropdown = function (e) { var $el = e.data.el; $this = $(this), $next = $this.next(); $next.slideToggle(); $this.parent().toggleClass('open'); if (!e.data.multiple) { $el.find('.submenu').not($next).slideUp().parent().removeClass('open'); }; } var accordion = new Accordion($('#accordion'), false); });