Initial Commit N° : 003 - V.4.3.5
This commit is contained in:
+106
-14
@@ -4,7 +4,7 @@ if (typeof _cookie_live === 'undefined') {
|
||||
var originalTitle = document.title;
|
||||
var notificationInterval;
|
||||
var currentMessageIndex = 0;
|
||||
var timeout_popup_static;
|
||||
var timeout_popup_static,timeout_box_shadow ;
|
||||
/* Document ready */
|
||||
jQuery(document).ready(function ($) {
|
||||
"use strict";
|
||||
@@ -284,7 +284,7 @@ jQuery(document).ready(function ($) {
|
||||
/**
|
||||
* For Checkout Page
|
||||
*/
|
||||
if ($('body').hasClass('woocommerce-checkout') || $('form.woocommerce-checkout').length) {
|
||||
if ($('body').hasClass('woocommerce-checkout') || $('form.woocommerce-checkout').length || $('#cart-sidebar').length <= 0) {
|
||||
var _href = $(this).attr('href');
|
||||
window.location.href = _href;
|
||||
|
||||
@@ -305,7 +305,7 @@ jQuery(document).ready(function ($) {
|
||||
$('body').trigger('nasa_cross_sell_columns_setting', [$('#cart-sidebar .cross-sells').find('.nasa-slick-slider')]);
|
||||
}
|
||||
|
||||
if ($('#cart-sidebar').length && !$('#cart-sidebar').hasClass('nasa-active')) {
|
||||
if (!$('#cart-sidebar').hasClass('nasa-active')) {
|
||||
|
||||
$('#cart-sidebar').addClass('nasa-active');
|
||||
|
||||
@@ -324,7 +324,7 @@ jQuery(document).ready(function ($) {
|
||||
}
|
||||
|
||||
$('body').trigger('nasa_opened_cart_sidebar');
|
||||
$('body').trigger('init_carousel_pro_empty_sidebar',[$('#cart-sidebar')]);
|
||||
$('body').trigger('init_carousel_pro_empty_sidebar', [$('#cart-sidebar')]);
|
||||
|
||||
if ($('.nasa-close-notice').length) {
|
||||
$('.nasa-close-notice').trigger('click');
|
||||
@@ -1091,7 +1091,7 @@ jQuery(document).ready(function ($) {
|
||||
|
||||
var url = window.location.origin + window.location.pathname;
|
||||
$(_wrap).html(data.content);
|
||||
var _current = $(_wrap).find('a[href="' + url + '"]:not(.logo)');
|
||||
var _current = $(_wrap).find('a[href="' + url + '"]:not(.logo)');
|
||||
var _svg = '<svg width="32" height="32" viewBox="0 0 22 32"><path d="M11.001 0.006c-5.889 0-10.663 4.775-10.663 10.663 0 1.945 0.523 3.762 1.432 5.332l9.23 15.994 9.23-15.994c0.909-1.57 1.432-3.387 1.432-5.332 0-5.888-4.774-10.663-10.662-10.663zM11.001 13.334c-1.472 0-2.666-1.193-2.666-2.665 0-1.471 1.194-2.665 2.666-2.665s2.665 1.194 2.665 2.665c0 1.472-1.193 2.665-2.665 2.665z" fill="currentColor"/></svg>';
|
||||
|
||||
if ($(_current).length) {
|
||||
@@ -1130,7 +1130,7 @@ jQuery(document).ready(function ($) {
|
||||
distance = 60;
|
||||
|
||||
// swipe horizontal to close
|
||||
$('body').on('touchstart', '#cart-sidebar, #nasa-wishlist-sidebar, #nasa-viewed-sidebar, #nasa-quickview-sidebar, #nasa-menu-sidebar-content, .nasa-top-cat-filter-wrap-mobile, .nasa-top-sidebar, .account-nav-wrap.vertical-tabs, .ns-sticky-scroll-sidebar', function (e) {
|
||||
$('body').on('touchstart', '#cart-sidebar, #nasa-wishlist-sidebar, #nasa-viewed-sidebar, #nasa-quickview-sidebar, #nasa-menu-sidebar-content, .nasa-top-cat-filter-wrap-mobile, .nasa-top-sidebar, .account-nav-wrap.vertical-tabs, .ns-sticky-scroll-sidebar, #vertical-menu-float.nasa-active', function (e) {
|
||||
touchstart = 0;
|
||||
if (!$(e.target).hasClass('slick-active') && !$(e.target).parents('.nasa-slick-slider').length) {
|
||||
touchstart = e.touches[0].clientX;
|
||||
@@ -1153,7 +1153,7 @@ jQuery(document).ready(function ($) {
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('touchmove', '#nasa-menu-sidebar-content, .nasa-top-cat-filter-wrap-mobile, .nasa-top-sidebar, .account-nav-wrap.vertical-tabs', function (e) {
|
||||
$('body').on('touchmove', '#nasa-menu-sidebar-content, .nasa-top-cat-filter-wrap-mobile, .nasa-top-sidebar, .account-nav-wrap.vertical-tabs, #vertical-menu-float.nasa-active', function (e) {
|
||||
touchend = e.changedTouches[0].clientX;
|
||||
|
||||
if (touchstart != touchend && touchstart != 0 && Math.abs(touchstart - touchend) > distance) {
|
||||
@@ -2338,15 +2338,16 @@ jQuery(document).ready(function ($) {
|
||||
* Login / Register Popup
|
||||
*/
|
||||
$('body').on('click', '.nasa-login-register-ajax', function () {
|
||||
if ($('#nasa-login-register-form').length <= 0) {
|
||||
var _content = $('#tmpl-nasa-register-form').html();
|
||||
$('.nasa-login-register-warper').html(_content);
|
||||
$('#tmpl-nasa-register-form').remove();
|
||||
if (!$('body').hasClass('logged-in')) {
|
||||
if ($('#nasa-login-register-form').length <= 0) {
|
||||
var _content = $('#tmpl-nasa-register-form').html();
|
||||
$('.nasa-login-register-warper').html(_content);
|
||||
$('#tmpl-nasa-register-form').remove();
|
||||
|
||||
$('body').trigger('nasa_login_register_ajax_inited');
|
||||
}
|
||||
$('body').trigger('nasa_login_register_ajax_inited');
|
||||
}
|
||||
|
||||
if ($(this).attr('data-enable') === '1' && $('#customer_login').length <= 0) {
|
||||
if ($(this).attr('data-enable') === '1' && $('#customer_login').length <= 0) {
|
||||
$('#nasa-menu-sidebar-content').removeClass('nasa-active');
|
||||
$('#mobile-navigation').attr('data-show', '0');
|
||||
|
||||
@@ -2420,6 +2421,9 @@ jQuery(document).ready(function ($) {
|
||||
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
window.location.href = $(this).attr('href');
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -2676,4 +2680,92 @@ jQuery(document).ready(function ($) {
|
||||
$(_nav).find('.nasa-nav-arrow.slick-next ').attr('class',$(_slider).find('.nasa-nav-arrow.slick-next ').attr('class'));
|
||||
|
||||
});
|
||||
|
||||
$('body').on('click','#vertical-menu-float .vertical_float_menu_title a, .nasa-vertical-menu-float-mobile-toggle, .vertical_float_menu_toggle .nasa-title-vertical-menu', function() {
|
||||
var _wrap = $('#vertical-menu-float');
|
||||
if ($(_wrap).hasClass('nasa-active')) {
|
||||
$('.black-window').fadeOut(200).removeClass('desk-window');
|
||||
|
||||
timeout_box_shadow = setTimeout(function() {
|
||||
$('.black-window').removeClass('vertical-menu-float-bg');
|
||||
$(_wrap).removeClass('nav-dropdown-delay-0');
|
||||
}, 300);
|
||||
|
||||
$(_wrap).removeClass('nasa-active');
|
||||
$('body').removeClass('m-ovhd');
|
||||
} else {
|
||||
if (typeof timeout_box_shadow !== 'undefined') {
|
||||
clearTimeout(timeout_box_shadow);
|
||||
}
|
||||
$(_wrap).addClass('nasa-active');
|
||||
$('.black-window').fadeIn(200).addClass('desk-window vertical-menu-float-bg');
|
||||
$('body').addClass('m-ovhd');
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('mouseleave', '#vertical-menu-float', function () {
|
||||
var _this = $(this);
|
||||
|
||||
if (!_mobileView && !$('body').hasClass('nasa-in-mobile') && !$('body').hasClass('nasa-mobile-app')) {
|
||||
if ($(_this).hasClass('nasa-active')) {
|
||||
$(_this).find('.vertical_float_menu_title a').trigger('click');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('mousemove', '#vertical-menu-float', function (e) {
|
||||
var _this = $(this);
|
||||
var width = $(_this).width();
|
||||
if (_mobileView || $('body').hasClass('nasa-in-mobile') || $('body').hasClass('nasa-mobile-app')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$(_this).hasClass('nasa-active')) {
|
||||
$(_this).find('.vertical_float_menu_title a').trigger('click');
|
||||
|
||||
} else if (!$(_this).hasClass('nav-dropdown-delay-0') && width >= 280) {
|
||||
$(_this).addClass('nav-dropdown-delay-0');
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('click', '#vertical-menu-float .vertical-menu-float-wrapper >li.menu-item-has-children >.nasa-title-menu',function(event) {
|
||||
if (_mobileView || $('body').hasClass('nasa-in-mobile') || $('body').hasClass('nasa-mobile-app')) {
|
||||
|
||||
event.preventDefault();
|
||||
var _this = $(this);
|
||||
var _parent = $(_this).parents('.menu-item-has-children');
|
||||
var _dropdown = $(_parent).find('>.nav-dropdown');
|
||||
var _itemactive = $('#vertical-menu-float .vertical-menu-float-wrapper >li.menu-item-has-children.nasa-active');
|
||||
|
||||
if ($(_parent).hasClass('nasa-active')) {
|
||||
$(_parent).removeClass('nasa-active');
|
||||
$(_dropdown).slideUp(300);
|
||||
} else {
|
||||
$(_parent).addClass('nasa-active');
|
||||
$(_dropdown).slideDown(300);
|
||||
$(_itemactive).removeClass('nasa-active');
|
||||
$(_itemactive).find('>.nav-dropdown').slideUp(300);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('nasa_media_all_pause',function() {
|
||||
$('video, audio').each(function() {
|
||||
if (!this.paused) {
|
||||
this.pause();
|
||||
}
|
||||
});
|
||||
|
||||
$('iframe').each(function() {
|
||||
var iframe = this;
|
||||
var src = $(iframe).attr('src');
|
||||
|
||||
if (src && src.includes('youtube.com/embed') && iframe.contentWindow) {
|
||||
iframe.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
|
||||
} else {
|
||||
$(iframe).attr('src',src);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user