Initial commit
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,248 @@
|
||||
/*!
|
||||
* Distpicker v1.0.4
|
||||
* https://github.com/fengyuanchen/distpicker
|
||||
*
|
||||
* Copyright (c) 2014-2016 Fengyuan Chen
|
||||
* Released under the MIT license
|
||||
*
|
||||
* Date: 2016-06-01T15:05:52.606Z
|
||||
*/
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as anonymous module.
|
||||
define(['jquery', 'ChineseDistricts'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node / CommonJS
|
||||
factory(require('jquery'), require('ChineseDistricts'));
|
||||
} else {
|
||||
// Browser globals.
|
||||
factory(jQuery, ChineseDistricts);
|
||||
}
|
||||
})(function ($, ChineseDistricts) {
|
||||
|
||||
'use strict';
|
||||
|
||||
if (typeof ChineseDistricts === 'undefined') {
|
||||
throw new Error('The file "distpicker.data.js" must be included first!');
|
||||
}
|
||||
|
||||
var NAMESPACE = 'distpicker';
|
||||
var EVENT_CHANGE = 'change.' + NAMESPACE;
|
||||
var PROVINCE = 'province';
|
||||
var CIRY = 'city';
|
||||
var DISTRICT = 'district';
|
||||
|
||||
function Distpicker(element, options) {
|
||||
this.$element = $(element);
|
||||
this.options = $.extend({}, Distpicker.DEFAULTS, $.isPlainObject(options) && options);
|
||||
this.placeholders = $.extend({}, Distpicker.DEFAULTS);
|
||||
this.active = false;
|
||||
this.init();
|
||||
}
|
||||
|
||||
Distpicker.prototype = {
|
||||
constructor: Distpicker,
|
||||
|
||||
init: function () {
|
||||
var options = this.options;
|
||||
var $select = this.$element.find('select');
|
||||
var length = $select.length;
|
||||
var data = {};
|
||||
|
||||
$select.each(function () {
|
||||
$.extend(data, $(this).data());
|
||||
});
|
||||
|
||||
$.each([PROVINCE, CIRY, DISTRICT], $.proxy(function (i, type) {
|
||||
if (data[type]) {
|
||||
options[type] = data[type];
|
||||
this['$' + type] = $select.filter('[data-' + type + ']');
|
||||
} else {
|
||||
this['$' + type] = length > i ? $select.eq(i) : null;
|
||||
}
|
||||
}, this));
|
||||
|
||||
this.bind();
|
||||
|
||||
// Reset all the selects (after event binding)
|
||||
this.reset();
|
||||
|
||||
this.active = true;
|
||||
},
|
||||
|
||||
bind: function () {
|
||||
if (this.$province) {
|
||||
this.$province.on(EVENT_CHANGE, (this._changeProvince = $.proxy(function () {
|
||||
this.output(CIRY);
|
||||
this.output(DISTRICT);
|
||||
}, this)));
|
||||
}
|
||||
|
||||
if (this.$city) {
|
||||
this.$city.on(EVENT_CHANGE, (this._changeCity = $.proxy(function () {
|
||||
this.output(DISTRICT);
|
||||
}, this)));
|
||||
}
|
||||
},
|
||||
|
||||
unbind: function () {
|
||||
if (this.$province) {
|
||||
this.$province.off(EVENT_CHANGE, this._changeProvince);
|
||||
}
|
||||
|
||||
if (this.$city) {
|
||||
this.$city.off(EVENT_CHANGE, this._changeCity);
|
||||
}
|
||||
},
|
||||
|
||||
output: function (type) {
|
||||
var options = this.options;
|
||||
var placeholders = this.placeholders;
|
||||
var $select = this['$' + type];
|
||||
var districts = {};
|
||||
var data = [];
|
||||
var code;
|
||||
var matched;
|
||||
var value;
|
||||
|
||||
if (!$select || !$select.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
value = options[type];
|
||||
|
||||
code = (
|
||||
type === PROVINCE ? 86 :
|
||||
type === CIRY ? this.$province && this.$province.find(':selected').data('code') :
|
||||
type === DISTRICT ? this.$city && this.$city.find(':selected').data('code') : code
|
||||
);
|
||||
|
||||
districts = $.isNumeric(code) ? ChineseDistricts[code] : null;
|
||||
|
||||
if ($.isPlainObject(districts)) {
|
||||
$.each(districts, function (code, address) {
|
||||
var selected = address === value;
|
||||
|
||||
if (selected) {
|
||||
matched = true;
|
||||
}
|
||||
|
||||
data.push({
|
||||
code: code,
|
||||
address: address,
|
||||
selected: selected
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (!matched) {
|
||||
if (data.length && (options.autoSelect || options.autoselect)) {
|
||||
data[0].selected = true;
|
||||
}
|
||||
|
||||
// Save the unmatched value as a placeholder at the first output
|
||||
if (!this.active && value) {
|
||||
placeholders[type] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Add placeholder option
|
||||
if (options.placeholder) {
|
||||
data.unshift({
|
||||
code: '',
|
||||
address: placeholders[type],
|
||||
selected: false
|
||||
});
|
||||
}
|
||||
|
||||
$select.html(this.getList(data));
|
||||
},
|
||||
|
||||
getList: function (data) {
|
||||
var list = [];
|
||||
|
||||
$.each(data, function (i, n) {
|
||||
list.push(
|
||||
'<option' +
|
||||
' value="' + (n.address && n.code ? n.address : '') + '"' +
|
||||
' data-code="' + (n.code || '') + '"' +
|
||||
(n.selected ? ' selected' : '') +
|
||||
'>' +
|
||||
(n.address || '') +
|
||||
'</option>'
|
||||
);
|
||||
});
|
||||
|
||||
return list.join('');
|
||||
},
|
||||
|
||||
reset: function (deep) {
|
||||
if (!deep) {
|
||||
this.output(PROVINCE);
|
||||
this.output(CIRY);
|
||||
this.output(DISTRICT);
|
||||
} else if (this.$province) {
|
||||
this.$province.find(':first').prop('selected', true).trigger(EVENT_CHANGE);
|
||||
}
|
||||
},
|
||||
|
||||
destroy: function () {
|
||||
this.unbind();
|
||||
this.$element.removeData(NAMESPACE);
|
||||
}
|
||||
};
|
||||
|
||||
Distpicker.DEFAULTS = {
|
||||
autoSelect: true,
|
||||
placeholder: true,
|
||||
province: '—— 省 ——',
|
||||
city: '—— 市 ——',
|
||||
district: '—— 区 ——'
|
||||
};
|
||||
|
||||
Distpicker.setDefaults = function (options) {
|
||||
$.extend(Distpicker.DEFAULTS, options);
|
||||
};
|
||||
|
||||
// Save the other distpicker
|
||||
Distpicker.other = $.fn.distpicker;
|
||||
|
||||
// Register as jQuery plugin
|
||||
$.fn.distpicker = function (option) {
|
||||
var args = [].slice.call(arguments, 1);
|
||||
|
||||
return this.each(function () {
|
||||
var $this = $(this);
|
||||
var data = $this.data(NAMESPACE);
|
||||
var options;
|
||||
var fn;
|
||||
|
||||
if (!data) {
|
||||
if (/destroy/.test(option)) {
|
||||
return;
|
||||
}
|
||||
|
||||
options = $.extend({}, $this.data(), $.isPlainObject(option) && option);
|
||||
$this.data(NAMESPACE, (data = new Distpicker(this, options)));
|
||||
}
|
||||
|
||||
if (typeof option === 'string' && $.isFunction(fn = data[option])) {
|
||||
fn.apply(data, args);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.distpicker.Constructor = Distpicker;
|
||||
$.fn.distpicker.setDefaults = Distpicker.setDefaults;
|
||||
|
||||
// No conflict
|
||||
$.fn.distpicker.noConflict = function () {
|
||||
$.fn.distpicker = Distpicker.other;
|
||||
return this;
|
||||
};
|
||||
|
||||
$(function () {
|
||||
$('[data-toggle="distpicker"]').distpicker();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,300 @@
|
||||
function check_search(){
|
||||
var keywords=$("#global_search").val();
|
||||
if(!keywords){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$(document).ready(function($){
|
||||
|
||||
|
||||
//判断产品详情型号
|
||||
var xtsize = $(".xtProduct .xtProduct_title .xtProduct_title_list").length
|
||||
if( xtsize == 6){
|
||||
$(".xtProduct").addClass("xtProduct_content6");
|
||||
}
|
||||
if( xtsize == 7){
|
||||
$(".xtProduct").addClass("xtProduct_content7");
|
||||
}
|
||||
if( xtsize == 8){
|
||||
$(".xtProduct").addClass("xtProduct_content8");
|
||||
}
|
||||
if( xtsize == 9){
|
||||
$(".xtProduct").addClass("xtProduct_content9");
|
||||
}
|
||||
if( xtsize == 11){
|
||||
$(".xtProduct").addClass("xtProduct_content11");
|
||||
}
|
||||
if( xtsize == 12){
|
||||
$(".xtProduct").addClass("xtProduct_content12");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$(".MyOrder .MyOrder_content .MyOrder_content_bottom .content_bottom_txt .bottom_txt_list").each(function() {
|
||||
var h_1 = $(this).find(".list_body_product").height();
|
||||
$(this).find(".body_product_li").height(h_1);
|
||||
});
|
||||
|
||||
|
||||
|
||||
//视频播放
|
||||
$(".click_video").click(function() {
|
||||
$(".content_list_video").show();
|
||||
$(".content_list_video").show();
|
||||
$(".content_list_video .list_video_content video").trigger('play');
|
||||
});
|
||||
|
||||
$(".list_video_bg").click(function(){
|
||||
$(".content_list_video").hide();
|
||||
$(".content_list_video .list_video_content video").trigger('pause');
|
||||
});
|
||||
|
||||
$(".fa-close").click(function(){
|
||||
$(".content_list_video").hide();
|
||||
$(".content_list_video .list_video_content video").trigger('pause');
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$(".MyOrder .MyOrder_content .MyOrder_content_bottom .content_bottom_txt .bottom_txt_list").each(function() {
|
||||
var h_1 = $(this).find(".list_body_product").height();
|
||||
$(this).find(".body_product_li").height(h_1);
|
||||
});
|
||||
|
||||
|
||||
|
||||
//视频播放
|
||||
$(".click_video").click(function() {
|
||||
$(".content_list_video").show();
|
||||
$(".content_list_video").show();
|
||||
$(".content_list_video .list_video_content video").trigger('play');
|
||||
});
|
||||
|
||||
$(".list_video_bg").click(function(){
|
||||
$(".content_list_video").hide();
|
||||
$(".content_list_video .list_video_content video").trigger('pause');
|
||||
});
|
||||
|
||||
$(".fa-close").click(function(){
|
||||
$(".content_list_video").hide();
|
||||
$(".content_list_video .list_video_content video").trigger('pause');
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//销售合同
|
||||
$(".agree").click(function(){
|
||||
$("#fwtk").show();
|
||||
})
|
||||
$(".fa-close").click(function(){
|
||||
$("#fwtk").hide();
|
||||
})
|
||||
|
||||
|
||||
|
||||
var h = $(".UserCenter .UserCenter_right").height();
|
||||
$(".UserCenter .UserCenter_left").height(h + 40);
|
||||
|
||||
|
||||
//地址弹窗
|
||||
|
||||
$(".new_address").click(function(){
|
||||
$(".NewAddress").fadeIn();
|
||||
})
|
||||
$(".address_edit").click(function(){
|
||||
$(".NewAddress").fadeIn();
|
||||
$(".NewAddress_bg").show();
|
||||
})
|
||||
|
||||
$(".NewAddress_close").click(function(){
|
||||
$(".NewAddress").fadeOut();
|
||||
$(".NewAddress_bg").hide();
|
||||
})
|
||||
|
||||
//发票弹窗
|
||||
$(".InvoiceSetting").click(function(){
|
||||
|
||||
})
|
||||
$(".new_Invoice").click(function(){
|
||||
$(".NewInvoice").fadeIn();
|
||||
})
|
||||
$(".Invoice_edit").click(function(){
|
||||
$(".NewInvoice").fadeIn();
|
||||
$(".NewAddress_bg").show();
|
||||
})
|
||||
$(".SelectInvoice_close").click(function(){
|
||||
$(".SelectInvoice").fadeOut();
|
||||
$(".bg").hide();
|
||||
})
|
||||
$(".NewInvoice_close,.NewAddress_submit_cancel").click(function(){
|
||||
$(".NewInvoice").fadeOut();
|
||||
$(".NewAddress_bg").hide();
|
||||
})
|
||||
|
||||
//商品增减
|
||||
$(".bottom_content_list").each(function(){
|
||||
var t = $(this).find(".quantity");
|
||||
$(this).find(".add").click(function(){
|
||||
t.val(parseInt(t.val())+1);
|
||||
$(this).prevAll(".min").removeAttr("disabled");
|
||||
$(this).prevAll(".min").css("cursor","pointer");
|
||||
$(this).prevAll(".min").css("color","#333"); //当按加1时,解除$("#min")不可读状态
|
||||
})
|
||||
$(this).find(".min").click(function(){
|
||||
if (parseInt(t.val())>1) { //判断数量值大于1时才可以减少
|
||||
t.val(parseInt(t.val())-1)
|
||||
}else{
|
||||
$(this).attr("disabled","disabled");
|
||||
$(this).css("cursor","not-allowed");
|
||||
$(this).css("color","#cccccc"); //当$("#min")为1时,$("#min")不可读状态
|
||||
}
|
||||
if( t.val() == 1 ){
|
||||
$(this).attr("disabled","disabled");
|
||||
$(this).css("cursor","not-allowed");
|
||||
$(this).css("color","#cccccc");
|
||||
}
|
||||
})
|
||||
if( t.val() == 1 ){
|
||||
$(this).find(".min").attr("disabled","disabled");
|
||||
$(this).find(".min").css("cursor","not-allowed");
|
||||
$(this).find(".min").css("color","#cccccc");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//商品增减
|
||||
$(".xtProduct_contentList").each(function(){
|
||||
var t = $(this).find(".quantity");
|
||||
$(this).find(".add").click(function(){
|
||||
t.val(parseInt(t.val())+1);
|
||||
$(this).nextAll(".min").removeAttr("disabled");
|
||||
$(this).nextAll(".min").css("cursor","pointer");
|
||||
$(this).nextAll(".min").css("color","#333"); //当按加1时,解除$("#min")不可读状态
|
||||
})
|
||||
$(this).find(".min").click(function(){
|
||||
if (parseInt(t.val())>1) { //判断数量值大于1时才可以减少
|
||||
t.val(parseInt(t.val())-1)
|
||||
}else{
|
||||
$(this).attr("disabled","disabled");
|
||||
$(this).css("cursor","not-allowed");
|
||||
$(this).css("color","#cccccc"); //当$("#min")为1时,$("#min")不可读状态
|
||||
}
|
||||
if( t.val() == 1 ){
|
||||
$(this).attr("disabled","disabled");
|
||||
$(this).css("cursor","not-allowed");
|
||||
$(this).css("color","#cccccc");
|
||||
}
|
||||
})
|
||||
if( t.val() == 1 ){
|
||||
$(this).find(".min").attr("disabled","disabled");
|
||||
$(this).find(".min").css("cursor","not-allowed");
|
||||
$(this).find(".min").css("color","#cccccc");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//获取收件地址的个数
|
||||
function address_s(){
|
||||
var size = $(".AddressDetails .AddressDetails_content .AddressDetails_content_list").length
|
||||
$(".address_size").text(size);
|
||||
}
|
||||
address_s();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//手机端禁止滑动屏幕
|
||||
function touchmove(){//自定义函数
|
||||
$("body").on("touchmove",function(event){
|
||||
event.preventDefault;
|
||||
}, false)
|
||||
|
||||
}
|
||||
|
||||
function touchmove2(){//自定义函数
|
||||
$("body").off("touchmove");
|
||||
}
|
||||
var flag=true;
|
||||
$('.cd-nav-trigger').on('click', function () {
|
||||
if(flag){
|
||||
flag=false;
|
||||
touchmove();
|
||||
} else{
|
||||
flag=true;
|
||||
touchmove2();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//手机端导航
|
||||
function responsive() {
|
||||
if($(window).width() <= 1200){
|
||||
console.log('mobile navigation');
|
||||
|
||||
$('#mo_nav').infinitypush();
|
||||
|
||||
$('body').removeClass('desktop');
|
||||
} else {
|
||||
console.log('desktop navigation');
|
||||
|
||||
$('#mo_nav').infinitypush({
|
||||
destroy:true
|
||||
});
|
||||
|
||||
$('body').addClass('desktop');
|
||||
}
|
||||
}
|
||||
function windowResize(){
|
||||
$(window).resize(function(){
|
||||
responsive();
|
||||
});
|
||||
}
|
||||
responsive();
|
||||
windowResize();
|
||||
|
||||
|
||||
|
||||
var isLateralNavAnimating = false;
|
||||
|
||||
//open/close lateral navigation
|
||||
$('.cd-nav-trigger').on('click', function(event){
|
||||
event.preventDefault();
|
||||
if( !isLateralNavAnimating ) {
|
||||
if($(this).parents('.csstransitions').length > 0 ) isLateralNavAnimating = true;
|
||||
|
||||
$('body').toggleClass('navigation-is-open');
|
||||
$('.ma-infinitypush-wrapper').toggleClass('on');
|
||||
$('.cd-navigation-wrapper').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){
|
||||
//animation is over
|
||||
isLateralNavAnimating = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
+6
File diff suppressed because one or more lines are too long
@@ -0,0 +1,524 @@
|
||||
|
||||
|
||||
;(function($){
|
||||
|
||||
$.fn.infinitypush = function(options){
|
||||
|
||||
/**
|
||||
* Default options
|
||||
*/
|
||||
|
||||
var defaults = {
|
||||
offcanvas : true,
|
||||
offcanvasspeed : 400,
|
||||
offcanvasleft : true,
|
||||
openingspeed : 400,
|
||||
closingspeed : 400,
|
||||
spacing : 90,
|
||||
pushdirectionleft : true,
|
||||
autoScroll : true,
|
||||
scrollSpeed : 300,
|
||||
destroy : false
|
||||
};
|
||||
|
||||
var infinityPushWrapper = this;
|
||||
|
||||
var opts = $.extend( {}, defaults, options );
|
||||
|
||||
/**
|
||||
* Start Navigation functions
|
||||
*/
|
||||
|
||||
return this.each(function() {
|
||||
|
||||
var oldposition = $(this).data('oldposition') || $('body'),
|
||||
navWrapper = 'ma-infinitypush-wrapper',
|
||||
navWrapperDiv = '<div class="' + navWrapper + '"></div>',
|
||||
navButtonActive = 'ma-infinitypush-active-button',
|
||||
navButton = 'ma-infinitypush-button',
|
||||
navButtonDiv = '<div class="' + navButton + '"></div>',
|
||||
infinityPush = 'ma-infinitypush',
|
||||
infinityPushOpen = 'ma-infinitypush-open';
|
||||
|
||||
function destroy(){
|
||||
$('.' + navButton).unbind();
|
||||
$('.' + infinityPush).unbind();
|
||||
$('body').removeClass(infinityPushOpen);
|
||||
$('.' + navWrapper).next().removeAttr('style');
|
||||
$('.' + navWrapper).find('.ma-infinitypush-inactive').removeClass('ma-infinitypush-inactive');
|
||||
$('.' + navWrapper).find('.ma-infinitypush-active-item').removeClass('ma-infinitypush-active-item');
|
||||
$('.' + navWrapper).find('.ma-infinitypush-close-subnav').remove();
|
||||
$('.' + navWrapper).find('ul').removeAttr('style');
|
||||
infinityPushWrapper.prependTo(oldposition);
|
||||
infinityPushWrapper.removeClass('ma-infinitypush ma-infinitypush-sub-open');
|
||||
$('.' + navWrapper).remove();
|
||||
$(this).removeClass(infinityPush);
|
||||
infinityPushWrapper.stop().removeAttr('style');
|
||||
}
|
||||
|
||||
if(opts.destroy){
|
||||
if($(this).hasClass(infinityPush))
|
||||
destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
// Start navigation toggle function
|
||||
function infinityPushToggle() {
|
||||
|
||||
$('.' + navButton).on('click', function(){
|
||||
|
||||
if($('body').hasClass(infinityPushOpen)){
|
||||
closingAnimation();
|
||||
}
|
||||
else {
|
||||
openingAnimation();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if(!$(this).hasClass(infinityPush)){
|
||||
|
||||
$(this).data('oldposition', $(this).parent());
|
||||
|
||||
// Move navigation after body
|
||||
if(!$(this).parent().is('body')) {
|
||||
$('body').prepend($(this));
|
||||
}
|
||||
|
||||
// Wrapping the element & add new class name
|
||||
$(this).before(navWrapperDiv).addClass(infinityPush).appendTo('.' + navWrapper);
|
||||
|
||||
var navWidth = $('.' + navWrapper).width();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Start closing animation function
|
||||
function closingAnimation() {
|
||||
|
||||
if(opts.offcanvasleft == true) {
|
||||
$('.' + navWrapper).stop().animate({
|
||||
left: '-' + navWidth + 'px'
|
||||
}, opts.offcanvasspeed);
|
||||
} else {
|
||||
$('.' + navWrapper).stop().animate({
|
||||
right: '-' + navWidth + 'px'
|
||||
}, opts.offcanvasspeed);
|
||||
}
|
||||
|
||||
$('.' + infinityPush).stop().animate({
|
||||
opacity: 'hide'
|
||||
}, opts.offcanvasspeed);
|
||||
|
||||
if(opts.offcanvasleft == true) {
|
||||
$('.' + navWrapper).next().stop().animate({
|
||||
left: 0
|
||||
}, opts.offcanvasspeed);
|
||||
} else {
|
||||
$('.' + navWrapper).next().stop().animate({
|
||||
right: 0
|
||||
}, opts.offcanvasspeed);
|
||||
}
|
||||
|
||||
$('body').removeClass(infinityPushOpen);
|
||||
|
||||
}
|
||||
|
||||
// Start opening animation
|
||||
function openingAnimation() {
|
||||
|
||||
$('body').addClass(infinityPushOpen);
|
||||
|
||||
if(opts.offcanvasleft == true) {
|
||||
$('.' + navWrapper).stop().animate({
|
||||
left: 0
|
||||
}, opts.offcanvasspeed);
|
||||
} else {
|
||||
$('.' + navWrapper).stop().animate({
|
||||
right: 0
|
||||
}, opts.offcanvasspeed);
|
||||
}
|
||||
|
||||
$('.' + infinityPush).stop().animate({
|
||||
opacity: 'show'
|
||||
}, opts.offcanvasspeed);
|
||||
|
||||
if(opts.offcanvasleft == true) {
|
||||
$('.' + navWrapper).next().stop().animate({
|
||||
left: navWidth + 'px'
|
||||
}, opts.offcanvasspeed);
|
||||
} else {
|
||||
$('.' + navWrapper).next().stop().animate({
|
||||
right: navWidth + 'px'
|
||||
}, opts.offcanvasspeed);
|
||||
}
|
||||
|
||||
clickOutside();
|
||||
|
||||
}
|
||||
|
||||
// Start closing function by clicking outside the infinity navigation
|
||||
function clickOutside() {
|
||||
|
||||
$('.' + infinityPushOpen).on("mousedown touchstart", function (e) {
|
||||
|
||||
if($('.' + infinityPushOpen).length) {
|
||||
if (!$('.' + navWrapper).is(e.target) // if the target of the click isn't the container...
|
||||
&& $('.' + navWrapper).has(e.target).length === 0) // ... nor a descendant of the container
|
||||
{
|
||||
closingAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Start infinity push function
|
||||
$('.' + infinityPush).on('click', 'a', function(){
|
||||
|
||||
// General settings
|
||||
var navWidth = $(infinityPushWrapper).width(),
|
||||
headParentUL = $(this).parents(infinityPushWrapper).children('ul'),
|
||||
directParentUL = $(this).closest('ul'),
|
||||
subUL = $(this).parent().find('ul').first(),
|
||||
closeSubName = 'ma-infinitypush-close-subnav',
|
||||
closeSubLink = '<a href="#" class="' + closeSubName +'"></a>',
|
||||
inactiveList = 'ma-infinitypush-inactive',
|
||||
inactiveItem = 'ma-infinitypush-active-item',
|
||||
subOpen = 'ma-infinitypush-sub-open';
|
||||
|
||||
if ( headParentUL.hasClass(inactiveList) && headParentUL.siblings().not(inactiveList) ) {
|
||||
// Top UL has the class name & the siblings has not the class name
|
||||
|
||||
/**
|
||||
* If statement for closing or opening the menu list
|
||||
*/
|
||||
|
||||
if( directParentUL.hasClass(inactiveList) ){
|
||||
// Parent UL has the class name, close the sub menu
|
||||
|
||||
// Closing animation
|
||||
if(opts.pushdirectionleft == true) {
|
||||
directParentUL.find('ul').animate({
|
||||
right: -(navWidth - opts.spacing),
|
||||
opacity: 'hide'
|
||||
}, opts.closingspeed);
|
||||
} else {
|
||||
directParentUL.find('ul').animate({
|
||||
left: -(navWidth - opts.spacing),
|
||||
opacity: 'hide'
|
||||
}, opts.closingspeed);
|
||||
}
|
||||
|
||||
// Removing the class name
|
||||
if( $(this).parent().parent().parent().hasClass(subOpen) ) {
|
||||
$(infinityPushWrapper).removeClass(subOpen);
|
||||
} else {
|
||||
// reset the directParentUL width
|
||||
directParentUL.animate({
|
||||
width: navWidth - opts.spacing
|
||||
}, opts.closingspeed);
|
||||
}
|
||||
directParentUL.removeClass(inactiveList);
|
||||
directParentUL.find('ul').removeClass(inactiveList);
|
||||
directParentUL.siblings().removeClass(inactiveList);
|
||||
directParentUL.find('li').removeClass(inactiveItem);
|
||||
|
||||
// Removing the close link
|
||||
directParentUL.find('.' + closeSubName).animate({
|
||||
opacity: 'hide'
|
||||
}, opts.closingspeed,
|
||||
function() {
|
||||
$(this).remove();
|
||||
}
|
||||
);
|
||||
|
||||
return false;
|
||||
|
||||
} else {
|
||||
// Parent UL has not the class name, open the sub menu if exist or open the link
|
||||
|
||||
if ( ( subUL.length > 0 ) && ( !subUL.is(':visible') ) ) {
|
||||
// If sub UL exist & is visible
|
||||
|
||||
var getScrollPosition = directParentUL.scrollTop();
|
||||
|
||||
// Adding the class names
|
||||
$(this).parent().addClass(inactiveItem);
|
||||
directParentUL.addClass(inactiveList);
|
||||
|
||||
// Scrolling up function
|
||||
if(opts.autoScroll == true) {
|
||||
// Check if scroll position is not 0px
|
||||
if(getScrollPosition >= 1) {
|
||||
directParentUL.animate({ scrollTop: 0 }, opts.scrollSpeed);
|
||||
}
|
||||
}
|
||||
|
||||
// Adding the close link
|
||||
if(opts.autoScroll == true) {
|
||||
// Check if scroll position is not 0px
|
||||
if(getScrollPosition >= 1) {
|
||||
$(closeSubLink).delay(opts.scrollSpeed).insertAfter($(this)).css('display', 'none').animate({
|
||||
opacity: 'show'
|
||||
}, opts.openingspeed);
|
||||
} else {
|
||||
$(closeSubLink).insertAfter($(this)).css('display', 'none').animate({
|
||||
opacity: 'show'
|
||||
}, opts.openingspeed);
|
||||
}
|
||||
} else {
|
||||
if(getScrollPosition >= 1) {
|
||||
$(closeSubLink).insertAfter($(this)).css({
|
||||
display: 'none',
|
||||
top: getScrollPosition
|
||||
}).animate({
|
||||
opacity: 'show'
|
||||
}, opts.openingspeed);
|
||||
} else {
|
||||
$(closeSubLink).insertAfter($(this)).css({
|
||||
display: 'none',
|
||||
top: 0
|
||||
}).animate({
|
||||
opacity: 'show'
|
||||
}, opts.openingspeed);
|
||||
}
|
||||
}
|
||||
|
||||
// Opening animation
|
||||
if(opts.pushdirectionleft == true) {
|
||||
if(opts.autoScroll == true) {
|
||||
// Check if scroll position is not 0px
|
||||
if(getScrollPosition >= 1) {
|
||||
subUL.delay(opts.scrollSpeed).css({
|
||||
right: -(navWidth - opts.spacing)
|
||||
}).animate({
|
||||
right: 0,
|
||||
opacity: 'show',
|
||||
width: navWidth - opts.spacing
|
||||
}, opts.openingspeed);
|
||||
} else {
|
||||
subUL.css({
|
||||
right: -(navWidth - opts.spacing)
|
||||
}).animate({
|
||||
right: 0,
|
||||
opacity: 'show',
|
||||
width: navWidth - opts.spacing
|
||||
}, opts.openingspeed);
|
||||
}
|
||||
} else {
|
||||
if(getScrollPosition >= 1) {
|
||||
subUL.css({
|
||||
right: -(navWidth - opts.spacing),
|
||||
top: getScrollPosition
|
||||
}).animate({
|
||||
right: 0,
|
||||
opacity: 'show',
|
||||
width: navWidth - opts.spacing
|
||||
}, opts.openingspeed);
|
||||
} else {
|
||||
subUL.css({
|
||||
right: -(navWidth - opts.spacing),
|
||||
top: 0
|
||||
}).animate({
|
||||
right: 0,
|
||||
opacity: 'show',
|
||||
width: navWidth - opts.spacing
|
||||
}, opts.openingspeed);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
if(opts.autoScroll == true) {
|
||||
subUL.delay(opts.scrollSpeed).css({
|
||||
left: -(navWidth - opts.spacing)
|
||||
}).animate({
|
||||
left: 0,
|
||||
opacity: 'show',
|
||||
width: navWidth - opts.spacing
|
||||
}, opts.openingspeed);
|
||||
} else {
|
||||
if(getScrollPosition >= 1) {
|
||||
subUL.css({
|
||||
left: -(navWidth - opts.spacing),
|
||||
top: getScrollPosition
|
||||
}).animate({
|
||||
left: 0,
|
||||
opacity: 'show',
|
||||
width: navWidth - opts.spacing
|
||||
}, opts.openingspeed);
|
||||
} else {
|
||||
subUL.css({
|
||||
left: -(navWidth - opts.spacing),
|
||||
top: 0
|
||||
}).animate({
|
||||
left: 0,
|
||||
opacity: 'show',
|
||||
width: navWidth - opts.spacing
|
||||
}, opts.openingspeed);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Changing the directParentUL width
|
||||
directParentUL.animate({
|
||||
width: navWidth
|
||||
}, opts.openingspeed);
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
// Top UL has not the class name & the siblings has not the class name
|
||||
|
||||
if ( ( subUL.length > 0 ) && ( !subUL.is(':visible') ) ) {
|
||||
// If sub UL exist & is visible
|
||||
|
||||
var getScrollPosition = $('.' + infinityPush).scrollTop();
|
||||
|
||||
// Adding the class names
|
||||
$(this).parent().addClass(inactiveItem);
|
||||
directParentUL.addClass(inactiveList);
|
||||
directParentUL.siblings().addClass(inactiveList);
|
||||
if( $(infinityPushWrapper).find('ul').is(':visible') ) {
|
||||
$(infinityPushWrapper).addClass(subOpen);
|
||||
}
|
||||
|
||||
// Scrolling up function
|
||||
if(opts.autoScroll == true) {
|
||||
// Check if scroll position is not 0px
|
||||
if(getScrollPosition >= 1) {
|
||||
$('.' + infinityPush).animate({ scrollTop: 0 }, opts.scrollSpeed);
|
||||
}
|
||||
}
|
||||
|
||||
// Adding the close link
|
||||
if(opts.autoScroll == true) {
|
||||
// Check if scroll position is not 0px
|
||||
if(getScrollPosition >= 1) {
|
||||
$(closeSubLink).delay(opts.scrollSpeed).insertAfter($(this)).css('display', 'none').animate({
|
||||
opacity: 'show'
|
||||
}, opts.openingspeed);
|
||||
} else {
|
||||
$(closeSubLink).insertAfter($(this)).css('display', 'none').animate({
|
||||
opacity: 'show'
|
||||
}, opts.openingspeed);
|
||||
}
|
||||
} else {
|
||||
if(getScrollPosition >= 1) {
|
||||
$(closeSubLink).insertAfter($(this)).css({
|
||||
display: 'none',
|
||||
top: getScrollPosition
|
||||
}).animate({
|
||||
opacity: 'show'
|
||||
}, opts.openingspeed);
|
||||
} else {
|
||||
$(closeSubLink).insertAfter($(this)).css({
|
||||
display: 'none',
|
||||
top: 0
|
||||
}).animate({
|
||||
opacity: 'show'
|
||||
}, opts.openingspeed);
|
||||
}
|
||||
}
|
||||
|
||||
// Opening animation
|
||||
if(opts.pushdirectionleft == true) {
|
||||
// Check if autoscroll is enabled
|
||||
if(opts.autoScroll == true) {
|
||||
// Check if scroll position is not 0px
|
||||
if(getScrollPosition >= 1) {
|
||||
subUL.delay(opts.scrollSpeed).css({
|
||||
right: -(navWidth - opts.spacing)
|
||||
}).animate({
|
||||
right: 0,
|
||||
opacity: 'show',
|
||||
width: navWidth - opts.spacing
|
||||
}, opts.openingspeed);
|
||||
} else {
|
||||
subUL.css({
|
||||
right: -(navWidth - opts.spacing)
|
||||
}).animate({
|
||||
right: 0,
|
||||
opacity: 'show',
|
||||
width: navWidth - opts.spacing
|
||||
}, opts.openingspeed);
|
||||
}
|
||||
} else {
|
||||
if(getScrollPosition >= 1) {
|
||||
subUL.css({
|
||||
right: -(navWidth - opts.spacing),
|
||||
top: getScrollPosition
|
||||
}).animate({
|
||||
right: 0,
|
||||
opacity: 'show',
|
||||
width: navWidth - opts.spacing
|
||||
}, opts.openingspeed);
|
||||
} else {
|
||||
subUL.css({
|
||||
right: -(navWidth - opts.spacing),
|
||||
top: 0
|
||||
}).animate({
|
||||
right: 0,
|
||||
opacity: 'show',
|
||||
width: navWidth - opts.spacing
|
||||
}, opts.openingspeed);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(opts.autoScroll == true) {
|
||||
subUL.delay(opts.scrollSpeed).css({
|
||||
left: -(navWidth - opts.spacing)
|
||||
}).animate({
|
||||
left: 0,
|
||||
opacity: 'show',
|
||||
width: navWidth - opts.spacing
|
||||
}, opts.openingspeed);
|
||||
} else {
|
||||
if(getScrollPosition >= 1) {
|
||||
subUL.css({
|
||||
left: -(navWidth - opts.spacing),
|
||||
top: getScrollPosition
|
||||
}).animate({
|
||||
left: 0,
|
||||
opacity: 'show',
|
||||
width: navWidth - opts.spacing
|
||||
}, opts.openingspeed);
|
||||
} else {
|
||||
subUL.css({
|
||||
left: -(navWidth - opts.spacing),
|
||||
top: 0
|
||||
}).animate({
|
||||
left: 0,
|
||||
opacity: 'show',
|
||||
width: navWidth - opts.spacing
|
||||
}, opts.openingspeed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user