first commit
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Custom select
|
||||
oceanwpCustomSelects();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
CUSTOM SELECT
|
||||
============================================== */
|
||||
function oceanwpCustomSelects() {
|
||||
"use strict"
|
||||
|
||||
$j( oceanwpLocalize.customSelects ).customSelect( {
|
||||
customClass: 'theme-select'
|
||||
} );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
var $j = jQuery.noConflict(),
|
||||
$window = $j( window );
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Drop down mobile menu
|
||||
oceanwpDropDownMobile();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
DROPDOWN MOBILE SCRIPT
|
||||
============================================== */
|
||||
function oceanwpDropDownMobile() {
|
||||
"use strict"
|
||||
|
||||
if ( $j( 'body' ).hasClass( 'dropdown-mobile' ) ) {
|
||||
|
||||
// Open drop down menu
|
||||
$j( '.mobile-menu' ).on( 'click', function() {
|
||||
$j( '#mobile-dropdown' ).slideToggle( 500 );
|
||||
$j( this ).toggleClass( 'opened' );
|
||||
$j( '.mobile-menu > .hamburger' ).toggleClass( 'is-active' );
|
||||
return false;
|
||||
} );
|
||||
|
||||
// Close menu function
|
||||
var oceanwpDropDownMobileClose = function( e ) {
|
||||
$j( '#mobile-dropdown' ).slideUp( 200 );
|
||||
$j( '.mobile-menu' ).removeClass( 'opened' );
|
||||
$j( '.mobile-menu > .hamburger' ).removeClass( 'is-active' );
|
||||
}
|
||||
|
||||
var $owpmenu = $j( '.mobile-menu > .hamburger' );
|
||||
var isMenuOpen = false;
|
||||
$owpmenu.on('click', function () {
|
||||
isMenuOpen = !isMenuOpen;
|
||||
$owpmenu.attr('aria-expanded', isMenuOpen);
|
||||
});
|
||||
|
||||
// Declare useful vars
|
||||
var $hasChildren = $j( '#mobile-dropdown .menu-item-has-children' );
|
||||
|
||||
// Add dropdown toggle (plus)
|
||||
$hasChildren.children( 'a' ).append( '<span class="dropdown-toggle"></span>' );
|
||||
|
||||
// Toggle dropdowns
|
||||
var $dropdownTarget = $j( '.dropdown-toggle' );
|
||||
|
||||
// Check localization
|
||||
if ( oceanwpLocalize.sidrDropdownTarget == 'link' ) {
|
||||
$dropdownTarget = $j( '#mobile-dropdown li.menu-item-has-children > a' );
|
||||
}
|
||||
|
||||
// Add toggle click event
|
||||
$dropdownTarget.on( 'tap click', function() {
|
||||
|
||||
// Define toggle vars
|
||||
if ( oceanwpLocalize.sidrDropdownTarget == 'link' ) {
|
||||
var $toggleParentLi = $j( this ).parent( 'li' );
|
||||
} else {
|
||||
var $toggleParentLink = $j( this ).parent( 'a' ),
|
||||
$toggleParentLi = $toggleParentLink.parent( 'li' );
|
||||
}
|
||||
|
||||
// Get parent items and dropdown
|
||||
var $allParentLis = $toggleParentLi.parents( 'li' ),
|
||||
$dropdown = $toggleParentLi.children( 'ul' );
|
||||
|
||||
// Toogle items
|
||||
if ( ! $toggleParentLi.hasClass( 'active' ) ) {
|
||||
$hasChildren.not( $allParentLis ).removeClass( 'active' ).children( 'ul' ).slideUp( 'fast' );
|
||||
$toggleParentLi.addClass( 'active' ).children( 'ul' ).slideDown( 'fast' );
|
||||
} else {
|
||||
$toggleParentLi.removeClass( 'active' ).children( 'ul' ).slideUp( 'fast' );
|
||||
}
|
||||
|
||||
// Return false
|
||||
return false;
|
||||
|
||||
} );
|
||||
|
||||
// Close menu
|
||||
$j( document ).on( 'click', function() {
|
||||
oceanwpDropDownMobileClose();
|
||||
} ).on( 'click', '#mobile-dropdown', function( e ) {
|
||||
e.stopPropagation();
|
||||
} );
|
||||
|
||||
// Close on resize
|
||||
$window.resize( function() {
|
||||
if ( $window.width() >= 960 ) {
|
||||
oceanwpDropDownMobileClose();
|
||||
}
|
||||
} );
|
||||
|
||||
// Close menu if anchor link
|
||||
$j( '#mobile-dropdown li a[href*="#"]:not([href="#"])' ).on( 'click', function() {
|
||||
oceanwpDropDownMobileClose();
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
( function() {
|
||||
|
||||
var owpHeader = document.getElementById('site-header'),
|
||||
navWarap = document.querySelectorAll( '#mobile-dropdown nav' )[0];
|
||||
if ( ! owpHeader || ! navWarap ) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.addEventListener( 'keydown', function( event ) {
|
||||
|
||||
var selectors = 'input, a, button',
|
||||
elements = navWarap.querySelectorAll( selectors ),
|
||||
closMenu = document.querySelector( '.mobile-menu.opened' ),
|
||||
lastEl = elements[ elements.length - 1 ],
|
||||
firstEl = elements[0],
|
||||
activeEl = document.activeElement,
|
||||
tabKey = event.keyCode === 9,
|
||||
shiftKey = event.shiftKey;
|
||||
|
||||
|
||||
if ( ! shiftKey && tabKey && lastEl === activeEl ) {
|
||||
event.preventDefault();
|
||||
closMenu.focus();
|
||||
}
|
||||
|
||||
if ( shiftKey && tabKey && firstEl === activeEl ) {
|
||||
event.preventDefault();
|
||||
closMenu.focus();
|
||||
}
|
||||
|
||||
if ( shiftKey && tabKey && closMenu === activeEl ) {
|
||||
event.preventDefault();
|
||||
lastEl.focus();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}() );
|
||||
@@ -0,0 +1,48 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Drop down search
|
||||
oceanwpDropDownSearch();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
DROP DOWN SEARCH
|
||||
============================================== */
|
||||
function oceanwpDropDownSearch() {
|
||||
"use strict"
|
||||
|
||||
// Return if is the not this search style
|
||||
if ( 'drop_down' != oceanwpLocalize.menuSearchStyle ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $searchDropdownToggle = $j( 'a.search-dropdown-toggle' ),
|
||||
$searchDropdownForm = $j( '#searchform-dropdown' );
|
||||
|
||||
$searchDropdownToggle.click( function( event ) {
|
||||
// Display search form
|
||||
$searchDropdownForm.toggleClass( 'show' );
|
||||
// Active menu item
|
||||
$j( this ).parent( 'li' ).toggleClass( 'active' );
|
||||
// Focus
|
||||
var $transitionDuration = $searchDropdownForm.css( 'transition-duration' );
|
||||
$transitionDuration = $transitionDuration.replace( 's', '' ) * 1000;
|
||||
if ( $transitionDuration ) {
|
||||
setTimeout( function() {
|
||||
$searchDropdownForm.find( 'input.field' ).focus();
|
||||
}, $transitionDuration );
|
||||
}
|
||||
// Return false
|
||||
return false;
|
||||
} );
|
||||
|
||||
// Close on doc click
|
||||
$j( document ).on( 'click', function( event ) {
|
||||
if ( ! $j( event.target ).closest( '#searchform-dropdown.show' ).length ) {
|
||||
$searchDropdownToggle.parent( 'li' ).removeClass( 'active' );
|
||||
$searchDropdownForm.removeClass( 'show' );
|
||||
}
|
||||
} );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Responsive Video
|
||||
oceanwpInitFitVids();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
RESPONSIVE VIDEOS
|
||||
============================================== */
|
||||
function oceanwpInitFitVids( $context ) {
|
||||
"use strict"
|
||||
|
||||
$j( '.responsive-video-wrap, .responsive-audio-wrap', $context ).fitVids();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
var $j = jQuery.noConflict(),
|
||||
$window = $j( window ),
|
||||
$lastWindowWidth = $window.width(),
|
||||
$lastWindowHeight = $window.height();
|
||||
|
||||
$window.on( 'load', function() {
|
||||
"use strict";
|
||||
// Fixed footer
|
||||
oceanwpFixedFooter();
|
||||
} );
|
||||
|
||||
$window.resize( function() {
|
||||
"use strict";
|
||||
|
||||
var $windowWidth = $window.width(),
|
||||
$windowHeight = $window.height();
|
||||
|
||||
if ( $lastWindowWidth !== $windowWidth
|
||||
|| $lastWindowHeight !== $windowHeight ) {
|
||||
oceanwpFixedFooter();
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
FIXED FOOTER
|
||||
============================================== */
|
||||
function oceanwpFixedFooter() {
|
||||
"use strict"
|
||||
|
||||
if ( ! $j( 'body' ).hasClass( 'has-fixed-footer' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set main vars
|
||||
var $mainHeight = $j( '#main' ).outerHeight(),
|
||||
$htmlHeight = $j( 'html' ).height(),
|
||||
$offset = 0,
|
||||
$adminBar = $j( '#wpadminbar' );
|
||||
|
||||
if ( $adminBar.length ) {
|
||||
$offset = $adminBar.outerHeight();
|
||||
}
|
||||
|
||||
var $minHeight = $mainHeight + ( $window.height() - $htmlHeight - $offset );
|
||||
|
||||
// Add min height
|
||||
$j( '#main' ).css( 'min-height', $minHeight );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Full Screen header menu
|
||||
oceanwpFullScreenMenu();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
FULL SCREEN MENU
|
||||
============================================== */
|
||||
function oceanwpFullScreenMenu() {
|
||||
"use strict"
|
||||
|
||||
var $siteHeader = $j( '#site-header.full_screen-header' ),
|
||||
$menuWrap = $j( '#site-header.full_screen-header #full-screen-menu' ),
|
||||
$menuBar = $j( '#site-header.full_screen-header .menu-bar' ),
|
||||
$customLogo = $j( '#site-logo.has-full-screen-logo' );
|
||||
|
||||
if ( $menuBar.length ) {
|
||||
|
||||
// Open menu function
|
||||
var oceanwpFullScreenMenuOpen = function() {
|
||||
$siteHeader.addClass( 'nav-open' );
|
||||
$menuBar.addClass( 'exit' );
|
||||
$customLogo.addClass( 'opened' );
|
||||
$menuWrap.addClass( 'active' );
|
||||
$menuWrap.fadeIn( 200 );
|
||||
|
||||
var innerWidth = $j( 'html' ).innerWidth();
|
||||
$j( 'html' ).css( 'overflow', 'hidden' );
|
||||
var hiddenInnerWidth = $j( 'html' ).innerWidth();
|
||||
$j( 'html' ).css( 'margin-right', hiddenInnerWidth - innerWidth );
|
||||
}
|
||||
|
||||
// Close menu function
|
||||
var oceanwpFullScreenMenuClose = function() {
|
||||
$siteHeader.removeClass( 'nav-open' );
|
||||
$menuBar.removeClass( 'exit' );
|
||||
$customLogo.removeClass( 'opened' );
|
||||
$menuWrap.removeClass( 'active' );
|
||||
$menuWrap.fadeOut( 200 );
|
||||
|
||||
$j( 'html' ).css( {
|
||||
'overflow': '',
|
||||
'margin-right': ''
|
||||
} );
|
||||
$j( '#full-screen-menu #site-navigation ul > li.dropdown' ).removeClass( 'open-sub' );
|
||||
$j( '#full-screen-menu #site-navigation ul.sub-menu' ).slideUp( 200 );
|
||||
}
|
||||
|
||||
$menuBar.on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
if ( ! $j( this ).hasClass( 'exit' ) ) {
|
||||
oceanwpFullScreenMenuOpen();
|
||||
} else {
|
||||
oceanwpFullScreenMenuClose();
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
// Logic for open sub menus
|
||||
$j( '#full-screen-menu #site-navigation ul > li.dropdown > a > .text-wrap > span.nav-arrow, #full-screen-menu #site-navigation ul > li.dropdown > a[href="#"]' ).on( 'tap click', function() {
|
||||
|
||||
if ( $j( this ).closest( 'li.dropdown' ).find( '> ul.sub-menu' ).is( ':visible' ) ) {
|
||||
$j( this ).closest( 'li.dropdown' ).removeClass( 'open-sub' );
|
||||
$j( this ).closest( 'li.dropdown' ).find( '> ul.sub-menu' ).slideUp( 200 );
|
||||
} else {
|
||||
$j( this ).closest( 'li.dropdown' ).addClass( 'open-sub' );
|
||||
$j( this ).closest( 'li.dropdown' ).find( '> ul.sub-menu' ).slideDown( 200 );
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
} );
|
||||
|
||||
// Close menu if anchor link
|
||||
$j( '#full-screen-menu #site-navigation a.menu-link[href*="#"]:not([href="#"])' ).on( 'click', function() {
|
||||
oceanwpFullScreenMenuClose();
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
var $j = jQuery.noConflict(),
|
||||
$window = $j( window );
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Full Screen mobile menu
|
||||
oceanwpFullScreenMobile();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
FULL SCREEN MOBILE
|
||||
============================================== */
|
||||
function oceanwpFullScreenMobile() {
|
||||
"use strict"
|
||||
|
||||
if ( $j( 'body' ).hasClass( 'fullscreen-mobile' ) ) {
|
||||
|
||||
var $mobileMenu = $j( '#mobile-fullscreen' ),
|
||||
$mobileLink = $j( '.mobile-menu' );
|
||||
|
||||
// Close menu function
|
||||
var oceanwpFullScreenMobileClose = function( e ) {
|
||||
$mobileLink.removeClass( 'exit' );
|
||||
$mobileMenu.removeClass( 'active' ).fadeOut( 200 );
|
||||
|
||||
$j( 'html' ).css( {
|
||||
'overflow': '',
|
||||
'margin-right': ''
|
||||
} );
|
||||
$j( '#mobile-fullscreen nav ul > li.dropdown' ).removeClass( 'open-sub' );
|
||||
$j( '#mobile-fullscreen nav ul.sub-menu' ).slideUp( 200 );
|
||||
$j( '.mobile-menu > .hamburger' ).removeClass( 'is-active' );
|
||||
}
|
||||
|
||||
// Open full screen menu
|
||||
$mobileLink.on( 'click', function() {
|
||||
$j( this ).addClass( 'exit' );
|
||||
$mobileMenu.addClass( 'active' ).fadeIn( 200 );
|
||||
$j( '.mobile-menu > .hamburger' ).addClass( 'is-active' );
|
||||
|
||||
var innerWidth = $j( 'html' ).innerWidth();
|
||||
$j( 'html' ).css( 'overflow', 'hidden' );
|
||||
var hiddenInnerWidth = $j( 'html' ).innerWidth();
|
||||
$j( 'html' ).css( 'margin-right', hiddenInnerWidth - innerWidth );
|
||||
return false;
|
||||
} );
|
||||
|
||||
// Add dropdown toggle (plus)
|
||||
$j( '#mobile-fullscreen .menu-item-has-children' ).children( 'a' ).append( '<span class="dropdown-toggle"></span>' );
|
||||
|
||||
// Add toggle click event
|
||||
$j( '#mobile-fullscreen nav ul > li.menu-item-has-children > a > span.dropdown-toggle, #mobile-fullscreen nav ul > li.menu-item-has-children > a[href="#"]' ).on( 'tap click', function() {
|
||||
|
||||
if ( $j( this ).closest( 'li.menu-item-has-children' ).find( '> ul.sub-menu' ).is( ':visible' ) ) {
|
||||
$j( this ).closest( 'li.menu-item-has-children' ).removeClass( 'open-sub' );
|
||||
$j( this ).closest( 'li.menu-item-has-children' ).find( '> ul.sub-menu' ).slideUp( 200 );
|
||||
} else {
|
||||
$j( this ).closest( 'li.menu-item-has-children' ).addClass( 'open-sub' );
|
||||
$j( this ).closest( 'li.menu-item-has-children' ).find( '> ul.sub-menu' ).slideDown( 200 );
|
||||
}
|
||||
|
||||
return false;
|
||||
} );
|
||||
|
||||
// Close menu
|
||||
$j( '#mobile-fullscreen a.close' ).on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
oceanwpFullScreenMobileClose();
|
||||
} );
|
||||
|
||||
// Close menu if anchor link
|
||||
$j( '#mobile-fullscreen .fs-dropdown-menu li a[href*="#"]:not([href="#"]), #mobile-fullscreen #mobile-nav li a[href*="#"]:not([href="#"])' ).on( 'click', function() {
|
||||
oceanwpFullScreenMobileClose();
|
||||
} );
|
||||
|
||||
// Close on resize
|
||||
$window.resize( function() {
|
||||
if ( $window.width() >= 960 ) {
|
||||
oceanwpFullScreenMobileClose();
|
||||
}
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Header replace search
|
||||
oceanwpHeaderReplaceSearch();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
HEADER REPLACE SEARCH
|
||||
============================================== */
|
||||
function oceanwpHeaderReplaceSearch() {
|
||||
"use strict"
|
||||
|
||||
// Return if is the not this search style
|
||||
if ( 'header_replace' != oceanwpLocalize.menuSearchStyle ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Header
|
||||
var $header = $j( '#site-header' );
|
||||
|
||||
// If is top menu header style
|
||||
if ( $header.hasClass( 'top-header' ) ) {
|
||||
|
||||
// Show
|
||||
var $headerReplace = $j( '#searchform-header-replace' ),
|
||||
$siteLeft = $j( '#site-header.top-header .header-top .left' ),
|
||||
$siteRight = $j( '#site-header.top-header .header-top .right' );
|
||||
|
||||
$j( 'a.search-header-replace-toggle' ).click( function( event ) {
|
||||
// Display search form
|
||||
$headerReplace.toggleClass( 'show' );
|
||||
$siteLeft.toggleClass( 'hide' );
|
||||
$siteRight.toggleClass( 'hide' );
|
||||
// Focus
|
||||
var $transitionDuration = $headerReplace.css( 'transition-duration' );
|
||||
$transitionDuration = $transitionDuration.replace( 's', '' ) * 1000;
|
||||
if ( $transitionDuration ) {
|
||||
setTimeout( function() {
|
||||
$headerReplace.find( 'input[type="search"]' ).focus();
|
||||
}, $transitionDuration );
|
||||
}
|
||||
// Return false
|
||||
return false;
|
||||
} );
|
||||
|
||||
// Close on click
|
||||
$j( '#searchform-header-replace-close' ).click( function() {
|
||||
$headerReplace.removeClass( 'show' );
|
||||
$siteLeft.removeClass( 'hide' );
|
||||
$siteRight.removeClass( 'hide' );
|
||||
return false;
|
||||
} );
|
||||
|
||||
// Close on doc click
|
||||
$j( document ).on( 'click', function( event ) {
|
||||
if ( ! $j( event.target ).closest( $j( '#searchform-header-replace.show' ) ).length ) {
|
||||
$headerReplace.removeClass( 'show' );
|
||||
$siteLeft.removeClass( 'hide' );
|
||||
$siteRight.removeClass( 'hide' );
|
||||
}
|
||||
} );
|
||||
|
||||
} else {
|
||||
|
||||
// Show
|
||||
var $headerReplace = $j( '#searchform-header-replace' ),
|
||||
$siteNavigation = $j( '#site-header.header-replace #site-navigation' );
|
||||
|
||||
$j( 'a.search-header-replace-toggle' ).click( function( event ) {
|
||||
// Display search form
|
||||
$headerReplace.toggleClass( 'show' );
|
||||
$siteNavigation.toggleClass( 'hide' );
|
||||
var menu_width = $j( '#site-navigation > ul.dropdown-menu' ).width();
|
||||
$headerReplace.css( 'max-width', menu_width + 60 );
|
||||
// Focus
|
||||
var $transitionDuration = $headerReplace.css( 'transition-duration' );
|
||||
$transitionDuration = $transitionDuration.replace( 's', '' ) * 1000;
|
||||
if ( $transitionDuration ) {
|
||||
setTimeout( function() {
|
||||
$headerReplace.find( 'input[type="search"]' ).focus();
|
||||
}, $transitionDuration );
|
||||
}
|
||||
// Return false
|
||||
return false;
|
||||
} );
|
||||
|
||||
// Close on click
|
||||
$j( '#searchform-header-replace-close' ).click( function() {
|
||||
$headerReplace.removeClass( 'show' );
|
||||
$siteNavigation.removeClass( 'hide' );
|
||||
return false;
|
||||
} );
|
||||
|
||||
// Close on doc click
|
||||
$j( document ).on( 'click', function( event ) {
|
||||
if ( ! $j( event.target ).closest( $j( '#searchform-header-replace.show' ) ).length ) {
|
||||
$headerReplace.removeClass( 'show' );
|
||||
$siteNavigation.removeClass( 'hide' );
|
||||
}
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Header search form label
|
||||
oceanwpHeaderSearchForm();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
HEADER SEARCH FORM LABEL
|
||||
============================================== */
|
||||
function oceanwpHeaderSearchForm() {
|
||||
"use strict"
|
||||
|
||||
// Add class when the search input is not empty
|
||||
$j( 'form.header-searchform' ).each( function() {
|
||||
|
||||
var form = $j( this ),
|
||||
listener = form.find( 'input' ),
|
||||
$label = form.find( 'label' );
|
||||
|
||||
if ( listener.val().length ) {
|
||||
form.addClass( 'search-filled' );
|
||||
}
|
||||
|
||||
listener.on( 'keyup blur', function() {
|
||||
if ( listener.val().length > 0 ) {
|
||||
form.addClass( 'search-filled' );
|
||||
} else {
|
||||
form.removeClass( 'search-filled' );
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
var $j = jQuery.noConflict(),
|
||||
$window = $j( window );
|
||||
|
||||
$window.on( 'load', function() {
|
||||
"use strict";
|
||||
if ( $j.fn.infiniteScroll !== undefined && $j( 'div.infinite-scroll-nav' ).length ) {
|
||||
// Infinite scroll
|
||||
oceanwpInfiniteScrollInit();
|
||||
}
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
INFINITE SCROLL
|
||||
============================================== */
|
||||
function oceanwpInfiniteScrollInit() {
|
||||
"use strict"
|
||||
|
||||
// Get infinite scroll container
|
||||
var $container = $j( '.infinite-scroll-wrap' );
|
||||
|
||||
// Start infinite sccroll
|
||||
$container.infiniteScroll( {
|
||||
path : '.older-posts a',
|
||||
append : '.item-entry',
|
||||
status : '.scroller-status',
|
||||
hideNav : '.infinite-scroll-nav',
|
||||
history : false,
|
||||
} );
|
||||
|
||||
$container.on( 'load.infiniteScroll', function( event, response, path, items ) {
|
||||
|
||||
var $items = $j( response ).find( '.item-entry' );
|
||||
|
||||
$items.imagesLoaded( function() {
|
||||
|
||||
// Animate new Items
|
||||
$items.animate( {
|
||||
opacity : 1
|
||||
} );
|
||||
|
||||
// Force the images to be parsed to fix Safari issue
|
||||
$items.find( 'img' ).each( function( index, img ) {
|
||||
img.outerHTML = img.outerHTML;
|
||||
} );
|
||||
|
||||
// Isotope
|
||||
if ( $container.hasClass( 'blog-masonry-grid' ) ) {
|
||||
$container.isotope( 'appended', $items );
|
||||
$items.css( 'opacity', 0 );
|
||||
}
|
||||
|
||||
// Re-run functions
|
||||
if ( ! $j( 'body' ).hasClass( 'no-carousel' ) ) {
|
||||
oceanwpInitCarousel( $items );
|
||||
}
|
||||
|
||||
if ( ! $j( 'body' ).hasClass( 'no-lightbox' ) ) {
|
||||
oceanwpInitLightbox( $items );
|
||||
}
|
||||
|
||||
if ( ! $j( 'body' ).hasClass( 'no-fitvids' ) ) {
|
||||
oceanwpInitFitVids( $items );
|
||||
}
|
||||
|
||||
// Match heights
|
||||
if ( ! $j( 'body' ).hasClass( 'no-matchheight' ) ) {
|
||||
$j( '.blog-equal-heights .blog-entry-inner' ).matchHeight({ property: 'min-height' });
|
||||
}
|
||||
|
||||
// Gallery posts
|
||||
if ( $j( '.gallery-format' ).parent( '.thumbnail' ) && $j( '.blog-masonry-grid' ).length ) {
|
||||
setTimeout( function() {
|
||||
$j( '.blog-masonry-grid' ).isotope( 'layout' );
|
||||
}, 600 + 1 );
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Masonry grids
|
||||
oceanwpMasonryGrids();
|
||||
} );
|
||||
|
||||
$j( window ).on( 'orientationchange', function() {
|
||||
"use strict";
|
||||
// Masonry grids
|
||||
oceanwpMasonryGrids();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
MASONRY
|
||||
============================================== */
|
||||
function oceanwpMasonryGrids() {
|
||||
"use strict"
|
||||
|
||||
$j( '.blog-masonry-grid' ).each( function() {
|
||||
|
||||
var $this = $j( this ),
|
||||
$transitionDuration = '0.0',
|
||||
$layoutMode = 'masonry';
|
||||
|
||||
// Load isotope after images loaded
|
||||
$this.imagesLoaded( function() {
|
||||
$this.isotope( {
|
||||
itemSelector : '.isotope-entry',
|
||||
transformsEnabled : true,
|
||||
isOriginLeft : oceanwpLocalize.isRTL ? false : true,
|
||||
transitionDuration : $transitionDuration + 's'
|
||||
} );
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Match height elements
|
||||
oceanwpInitMatchHeight();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
MATCH HEIGHTS
|
||||
============================================== */
|
||||
function oceanwpInitMatchHeight() {
|
||||
"use strict"
|
||||
|
||||
// Add match heights grid
|
||||
$j( '.match-height-grid .match-height-content' ).matchHeight({ property: 'min-height' });
|
||||
|
||||
// Blog entries
|
||||
$j( '.blog-equal-heights .blog-entry-inner' ).matchHeight({ property: 'min-height' });
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
var $j = jQuery.noConflict(),
|
||||
$window = $j( window );
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Mega menu
|
||||
oceanwpMegaMenu();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
MEGA MENU
|
||||
============================================== */
|
||||
function oceanwpMegaMenu() {
|
||||
"use strict"
|
||||
|
||||
// Mega menu in top bar menu
|
||||
$j( '#top-bar-nav .megamenu-li.full-mega' ).hover( function() {
|
||||
var $topBar = $j( '#top-bar' ),
|
||||
$menuWidth = $topBar.width(),
|
||||
$menuPosition = $topBar.offset(),
|
||||
$menuItemPosition = $j( this ).offset(),
|
||||
$positionLeft = $menuItemPosition.left-$menuPosition.left+1;
|
||||
|
||||
if ( $j( 'body' ).hasClass( 'boxed-layout' ) ) {
|
||||
$positionLeft = $menuItemPosition.left-$menuPosition.left+1;
|
||||
$positionLeft = $positionLeft-30;
|
||||
}
|
||||
|
||||
$j( this ).find( '.megamenu' ).css( { 'left': '-'+$positionLeft+'px', 'width': $menuWidth } );
|
||||
} );
|
||||
|
||||
// Mega menu in principal menu
|
||||
$j( '#site-navigation .megamenu-li.full-mega' ).hover( function() {
|
||||
var $siteHeader = $j( '#site-header-inner' ),
|
||||
$menuWidth = $siteHeader.width(),
|
||||
$menuPosition = $siteHeader.offset(),
|
||||
$menuItemPosition = $j( this ).offset(),
|
||||
$positionLeft = $menuItemPosition.left-$menuPosition.left+1;
|
||||
|
||||
if ( $j( '#site-header' ).hasClass( 'medium-header' ) ) {
|
||||
$siteHeader = $j( '#site-navigation-wrap > .container' ),
|
||||
$menuWidth = $siteHeader.width(),
|
||||
$menuPosition = $siteHeader.offset(),
|
||||
$positionLeft = $menuItemPosition.left-$menuPosition.left+1;
|
||||
}
|
||||
|
||||
if ( $j( 'body' ).hasClass( 'boxed-layout' ) ) {
|
||||
$positionLeft = $menuItemPosition.left-$menuPosition.left+1;
|
||||
$positionLeft = $positionLeft-30;
|
||||
}
|
||||
|
||||
$j( this ).find( '.megamenu' ).css( { 'left': '-'+$positionLeft+'px', 'width': $menuWidth } );
|
||||
} );
|
||||
|
||||
// Megamenu auto width
|
||||
$j( '.navigation .megamenu-li.auto-mega .megamenu' ).each( function() {
|
||||
var $li = $j( this ).parent(),
|
||||
$liOffset = $li.offset().left,
|
||||
$liOffsetTop = $li.offset().top,
|
||||
$liWidth = $j( this ).parent().width(),
|
||||
$dropdowntMarginLeft = $liWidth/2,
|
||||
$dropdownWidth = $j( this ).outerWidth(),
|
||||
$dropdowntLeft = $liOffset - $dropdownWidth/2;
|
||||
|
||||
if ( $dropdowntLeft < 0 ) {
|
||||
var $left = $liOffset - 10;
|
||||
$dropdowntMarginLeft = 0;
|
||||
} else {
|
||||
var $left = $dropdownWidth/2;
|
||||
|
||||
}
|
||||
|
||||
if ( oceanwpLocalize.isRTL ) {
|
||||
$j( this ).css( {
|
||||
'right': - $left,
|
||||
'marginRight': $dropdowntMarginLeft
|
||||
} );
|
||||
} else {
|
||||
$j( this ).css( {
|
||||
'left': - $left,
|
||||
'marginLeft': $dropdowntMarginLeft
|
||||
} );
|
||||
}
|
||||
|
||||
var $dropdownRight = ( $window.width() ) - ( $liOffset - $left + $dropdownWidth + $dropdowntMarginLeft );
|
||||
|
||||
if ( $dropdownRight < 0 ) {
|
||||
$j( this ).css( {
|
||||
'left': 'auto',
|
||||
'right': - ( $window.width() - $liOffset - $liWidth - 10 )
|
||||
} );
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Nav no click
|
||||
oceanwpNavNoClick();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
NAV NO CLICK
|
||||
============================================== */
|
||||
function oceanwpNavNoClick() {
|
||||
"use strict"
|
||||
|
||||
$j( 'li.nav-no-click > a' ).on( 'click', function() {
|
||||
return false;
|
||||
} );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Overlay search
|
||||
oceanwpOverlaySearch();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
OVERLAY SEARCH
|
||||
============================================== */
|
||||
function oceanwpOverlaySearch() {
|
||||
"use strict"
|
||||
|
||||
// Return if is the not this search style
|
||||
if ( 'overlay' != oceanwpLocalize.menuSearchStyle ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $searchOverlayToggle = $j( 'a.search-overlay-toggle' ),
|
||||
$searchOverlayClose = $j( 'a.search-overlay-close' ),
|
||||
$searchOverlay = $j( '#searchform-overlay' );
|
||||
|
||||
if ( $searchOverlayToggle.length ) {
|
||||
|
||||
$searchOverlayToggle.on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
$searchOverlay.addClass( 'active' );
|
||||
$searchOverlay.fadeIn( 200 );
|
||||
|
||||
setTimeout( function() {
|
||||
$j( 'html' ).css( 'overflow', 'hidden' );
|
||||
}, 400);
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
$searchOverlayClose.on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
$searchOverlay.removeClass( 'active' );
|
||||
$searchOverlay.fadeOut( 200 );
|
||||
|
||||
setTimeout( function() {
|
||||
$j( 'html' ).css( 'overflow', 'visible' );
|
||||
}, 400);
|
||||
|
||||
} );
|
||||
|
||||
$searchOverlayToggle.on( 'click', function() {
|
||||
$j( '#searchform-overlay input' ).focus();
|
||||
} );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Parallax footer
|
||||
oceanwpParallaxFooter();
|
||||
} );
|
||||
|
||||
$j( window ).on( 'resize', function() {
|
||||
"use strict";
|
||||
// Parallax footer
|
||||
oceanwpParallaxFooter();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
PARALLAX FOOTER
|
||||
============================================== */
|
||||
function oceanwpParallaxFooter() {
|
||||
"use strict"
|
||||
|
||||
// Needed timeout for dynamic parallax content
|
||||
if ( $j( 'body' ).hasClass( 'has-parallax-footer' ) ) {
|
||||
|
||||
setTimeout( function() {
|
||||
$j( '#main' ).css( 'margin-bottom', $j( '.parallax-footer' ).outerHeight() );
|
||||
}, 1 );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
var $j = jQuery.noConflict(),
|
||||
$window = $j( window );
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Scroll effect
|
||||
oceanwpScrollEffect();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
SCROLL EFFECT
|
||||
============================================== */
|
||||
function oceanwpScrollEffect() {
|
||||
"use strict"
|
||||
|
||||
if ( ! $j( 'body' ).hasClass( 'single-product' )
|
||||
&& ! $j( 'body' ).hasClass( 'no-local-scroll' ) ) {
|
||||
|
||||
$j( 'a.local[href*="#"]:not([href="#"]), .local a[href*="#"]:not([href="#"]), a.menu-link[href*="#"]:not([href="#"]), a.sidr-class-menu-link[href*="#"]:not([href="#"])' ).on( 'click', function() {
|
||||
|
||||
if ( ! $j( this ).hasClass( 'omw-open-modal' )
|
||||
&& ! $j( this ).parent().hasClass( 'omw-open-modal' )
|
||||
&& ! $j( this ).parent().parent().parent().hasClass( 'omw-open-modal' )
|
||||
&& ! $j( this ).parent().hasClass( 'opl-link' ) ) {
|
||||
|
||||
var $href = $j( this ).attr( 'href' ),
|
||||
$hrefHash = $href.substr( $href.indexOf( '#' ) ).slice( 1 ),
|
||||
$target = $j( '#' + $hrefHash ),
|
||||
$adminbarHeight = oceanwpGetAdminbarHeight(),
|
||||
$topbarHeight = oceanwpGetTopbarHeight(),
|
||||
$stickyHeaderHeight = oceanwpGetStickyHeaderHeight(),
|
||||
$offset = $adminbarHeight + $topbarHeight + $stickyHeaderHeight,
|
||||
$scrollPosition;
|
||||
|
||||
if ( $target.length && '' !== $hrefHash ) {
|
||||
$scrollPosition = $target.offset().top - $offset;
|
||||
|
||||
$j( 'html, body' ).stop().animate( {
|
||||
scrollTop: Math.round( $scrollPosition )
|
||||
}, 1000 );
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Admin bar height
|
||||
function oceanwpGetAdminbarHeight() {
|
||||
"use strict"
|
||||
|
||||
var $offset = 0,
|
||||
$adminBar = $j( '#wpadminbar' );
|
||||
|
||||
if ( $adminBar.length ) {
|
||||
$offset = $adminBar.outerHeight();
|
||||
}
|
||||
|
||||
return $offset;
|
||||
}
|
||||
|
||||
// Top bar height
|
||||
function oceanwpGetTopbarHeight() {
|
||||
"use strict"
|
||||
|
||||
var $offset = 0,
|
||||
$stickyTopBar = $j( '#top-bar-wrap' );
|
||||
|
||||
if ( $stickyTopBar.hasClass( 'top-bar-sticky' )
|
||||
&& $stickyTopBar.length ) {
|
||||
$offset = $stickyTopBar.outerHeight();
|
||||
}
|
||||
|
||||
return $offset;
|
||||
}
|
||||
|
||||
// Header height
|
||||
function oceanwpGetStickyHeaderHeight() {
|
||||
"use strict"
|
||||
|
||||
var $offset = 0,
|
||||
$stickyHeader = $j( '#site-header' );
|
||||
|
||||
if ( ! $stickyHeader.length ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $stickyHeader.hasClass( 'fixed-scroll' ) ) {
|
||||
$offset = $stickyHeader.data( 'height' );
|
||||
}
|
||||
|
||||
if ( $window.width() <= 960
|
||||
&& ! $stickyHeader.hasClass( 'has-sticky-mobile' ) ) {
|
||||
$offset = $offset;
|
||||
}
|
||||
|
||||
if ( $stickyHeader.hasClass( 'medium-header' ) ) {
|
||||
if ( $j( '#site-header .bottom-header-wrap' ).hasClass( 'fixed-scroll' ) ) {
|
||||
$offset = $j( '#site-header .bottom-header-wrap' ).outerHeight();
|
||||
} else {
|
||||
$offset = $j( '.is-sticky #site-header-inner' ).outerHeight();
|
||||
}
|
||||
}
|
||||
|
||||
if ( $stickyHeader.hasClass( 'vertical-header' ) ) {
|
||||
$offset = $offset;
|
||||
}
|
||||
|
||||
return $offset;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
var $j = jQuery.noConflict(),
|
||||
$window = $j( window );
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Scroll top
|
||||
oceanwpScrollTop();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
SCROLL TOP
|
||||
============================================== */
|
||||
function oceanwpScrollTop() {
|
||||
"use strict"
|
||||
|
||||
var selectors = {
|
||||
scrollTop : '#scroll-top',
|
||||
topLink : 'a[href="#go-top"]',
|
||||
slashTopLink : 'body.home a[href="/#go-top"]'
|
||||
}
|
||||
|
||||
$window.on( 'scroll', function() {
|
||||
if ( $j( this ).scrollTop() > 100 ) {
|
||||
$j( '#scroll-top' ).fadeIn();
|
||||
} else {
|
||||
$j( '#scroll-top' ).fadeOut();
|
||||
}
|
||||
});
|
||||
|
||||
$j.each( selectors, function( key, value ){
|
||||
$j( value ).on( 'click', function(e){
|
||||
e.preventDefault();
|
||||
$j( 'html, body' ).animate( { scrollTop: 0 }, 400 );
|
||||
$j( this ).parent().removeClass( 'sfHover' );
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
var $j = jQuery.noConflict(),
|
||||
$window = $j( window );
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Mobile menu
|
||||
oceanwpMobileMenu();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
MOBILE SCRIPT
|
||||
============================================== */
|
||||
function oceanwpMobileMenu( event ) {
|
||||
"use strict"
|
||||
|
||||
if ( typeof oceanwpLocalize.sidrSource !== 'undefined'
|
||||
&& $j( 'body' ).hasClass( 'sidebar-mobile' ) ) {
|
||||
|
||||
var $first = true;
|
||||
|
||||
// Add sidr
|
||||
$j( '.mobile-menu' ).sidr( {
|
||||
name : 'sidr',
|
||||
source : oceanwpLocalize.sidrSource,
|
||||
side : oceanwpLocalize.sidrSide,
|
||||
displace : oceanwpLocalize.sidrDisplace,
|
||||
speed : 300,
|
||||
renaming : true,
|
||||
bind : 'click',
|
||||
|
||||
onOpen : function onOpen() {
|
||||
|
||||
// Class of the custom opening button
|
||||
$j( '.mobile-menu > .hamburger' ).addClass( 'is-active' );
|
||||
|
||||
if ( $first == true ) {
|
||||
// Declare useful vars
|
||||
var $hasChildren = $j( '.sidr-class-menu-item-has-children' );
|
||||
|
||||
var $sidrmenu = $j( '.mobile-menu > .hamburger' );
|
||||
var isMenuOpen = false;
|
||||
$sidrmenu.on('click', function () {
|
||||
isMenuOpen = !isMenuOpen;
|
||||
$sidrmenu.attr('aria-expanded', isMenuOpen);
|
||||
});
|
||||
|
||||
// Add dropdown toggle (plus)
|
||||
$hasChildren.children( 'a' ).append( '<span class="sidr-class-dropdown-toggle"></span>' );
|
||||
|
||||
// Toggle dropdowns
|
||||
var $sidrDropdownTarget = $j( '.sidr-class-dropdown-toggle' );
|
||||
|
||||
// Check localization
|
||||
if ( oceanwpLocalize.sidrDropdownTarget == 'link' ) {
|
||||
$sidrDropdownTarget = $j( 'li.sidr-class-menu-item-has-children > a' );
|
||||
}
|
||||
|
||||
// Add toggle click event
|
||||
$sidrDropdownTarget.on( 'click', function( event ) {
|
||||
|
||||
// Define toggle vars
|
||||
if ( oceanwpLocalize.sidrDropdownTarget == 'link' ) {
|
||||
var $toggleParentLi = $j( this ).parent( 'li' );
|
||||
} else {
|
||||
var $toggleParentLink = $j( this ).parent( 'a' ),
|
||||
$toggleParentLi = $toggleParentLink.parent( 'li' );
|
||||
}
|
||||
|
||||
// Get parent items and dropdown
|
||||
var $allParentLis = $toggleParentLi.parents( 'li' ),
|
||||
$dropdown = $toggleParentLi.children( 'ul' );
|
||||
|
||||
// Toogle items
|
||||
if ( ! $toggleParentLi.hasClass( 'active' ) ) {
|
||||
$hasChildren.not( $allParentLis ).removeClass( 'active' ).children( 'ul' ).slideUp( 'fast' );
|
||||
$toggleParentLi.addClass( 'active' ).children( 'ul' ).slideDown( 'fast' );
|
||||
} else {
|
||||
$toggleParentLi.removeClass( 'active' ).children( 'ul' ).slideUp( 'fast' );
|
||||
}
|
||||
|
||||
// Return false
|
||||
return false;
|
||||
|
||||
} );
|
||||
|
||||
$first = false;
|
||||
}
|
||||
|
||||
// Add light overlay to content
|
||||
$j( '#site-header' ).after( '<div class="oceanwp-sidr-overlay"></div>' );
|
||||
$j( '.oceanwp-sidr-overlay' ).fadeIn( 300 );
|
||||
|
||||
// Close sidr when clicking overlay
|
||||
$j( '.oceanwp-sidr-overlay' ).on( 'click', function() {
|
||||
$j.sidr( 'close', 'sidr' );
|
||||
return false;
|
||||
} );
|
||||
|
||||
// Close on resize
|
||||
$window.resize( function() {
|
||||
if ( $window.width() >= 960 ) {
|
||||
$j.sidr( 'close', 'sidr' );
|
||||
$j( '.mobile-menu > .hamburger' ).removeClass( 'is-active' );
|
||||
}
|
||||
} );
|
||||
|
||||
},
|
||||
onClose : function onClose() {
|
||||
|
||||
// Remove class of the custom opening button
|
||||
$j( '.mobile-menu > .hamburger' ).removeClass( 'is-active' );
|
||||
|
||||
// Remove active dropdowns
|
||||
$j( '.sidr-class-menu-item-has-children.active' ).removeClass( 'active' ).children( 'ul' ).hide();
|
||||
|
||||
// FadeOut overlay
|
||||
$j( '.oceanwp-sidr-overlay' ).fadeOut( 300, function() {
|
||||
$j( this ).remove();
|
||||
} );
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
// Replace Font Awesome icons class
|
||||
$j( '#sidr [class*="sidr-class-fa"]' ).attr( 'class', function( i, c ) {
|
||||
c = c.replace( 'sidr-class-fa', 'fa' );
|
||||
c = c.replace( 'sidr-class-fa-', 'fa-' );
|
||||
return c;
|
||||
} );
|
||||
|
||||
// Replace Simple Line Icons class
|
||||
$j( '#sidr [class*="sidr-class-icon"]' ).attr( 'class', function( i, c ) {
|
||||
c = c.replace( 'sidr-class-icon-', 'icon-' );
|
||||
return c;
|
||||
} );
|
||||
|
||||
// Close sidr when clicking on close button
|
||||
$j( 'a.sidr-class-toggle-sidr-close' ).on( 'click', function() {
|
||||
$j.sidr( 'close', 'sidr' );
|
||||
$j( '.mobile-menu > .hamburger' ).removeClass( 'is-active' );
|
||||
return false;
|
||||
} );
|
||||
|
||||
// Close when clicking local scroll link
|
||||
$j( '.sidr-class-dropdown-menu a[href*="#"]:not([href="#"]), .sidr-class-menu-item > a[href*="#"]:not([href="#"])' ).on( 'click', function() {
|
||||
$j.sidr( 'close', 'sidr' );
|
||||
$j( '.mobile-menu > .hamburger' ).removeClass( 'is-active' );
|
||||
} );
|
||||
|
||||
// If disable link
|
||||
$j( 'li.sidr-class-nav-no-click > a' ).on( 'click', function() {
|
||||
return false;
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function owpSidrDropdown() {
|
||||
|
||||
var owpHeader = document.getElementById('site-header'),
|
||||
navWarap = document.querySelectorAll( '#sidr' )[0],
|
||||
sidrClose = document.querySelector( '.sidr-class-toggle-sidr-close' );
|
||||
if ( ! owpHeader || ! navWarap ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var mobileIcon = document.querySelector( '.mobile-menu' );
|
||||
|
||||
mobileIcon.addEventListener( 'click', function() {
|
||||
if ( ! sidrClose.classList.contains( 'opened' ) ) {
|
||||
sidrClose.classList.toggle( 'opened' );
|
||||
} else {
|
||||
sidrClose.classList.remove( 'opened' );
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
sidrClose.addEventListener( 'click', function() {
|
||||
sidrClose.classList.remove( 'opened' );
|
||||
});
|
||||
|
||||
document.addEventListener( 'keydown', function( event ) {
|
||||
|
||||
var selectors = 'input, a, button',
|
||||
elements = navWarap.querySelectorAll( selectors ),
|
||||
closMenu = document.querySelector( '.sidr-class-toggle-sidr-close.opened' ),
|
||||
lastEl = elements[ elements.length - 1 ],
|
||||
firstEl = elements[0],
|
||||
activeEl = document.activeElement,
|
||||
tabKey = event.keyCode === 9,
|
||||
shiftKey = event.shiftKey;
|
||||
|
||||
if ( ! closMenu ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! shiftKey && tabKey && lastEl === activeEl ) {
|
||||
event.preventDefault();
|
||||
closMenu.focus();
|
||||
}
|
||||
|
||||
if ( shiftKey && tabKey && firstEl === activeEl ) {
|
||||
event.preventDefault();
|
||||
closMenu.focus();
|
||||
}
|
||||
|
||||
if ( shiftKey && tabKey && closMenu === activeEl ) {
|
||||
event.preventDefault();
|
||||
lastEl.focus();
|
||||
}
|
||||
|
||||
closMenu.addEventListener( 'click', function() {
|
||||
mobileIcon.focus();
|
||||
} );
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
document.addEventListener(
|
||||
'DOMContentLoaded',
|
||||
function() {
|
||||
owpSidrDropdown();
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,45 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Carousel
|
||||
oceanwpInitCarousel();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
CAROUSEL
|
||||
============================================== */
|
||||
function oceanwpInitCarousel( $context ) {
|
||||
"use strict"
|
||||
|
||||
var $carousel = $j( '.gallery-format, .product-entry-slider', $context );
|
||||
|
||||
// If RTL
|
||||
if ( $j( 'body' ).hasClass( 'rtl' ) ) {
|
||||
var rtl = true;
|
||||
} else {
|
||||
var rtl = false;
|
||||
}
|
||||
|
||||
// Return autoplay to false if woo slider
|
||||
if ( $carousel.hasClass( 'woo-entry-image' ) ) {
|
||||
var autoplay = false;
|
||||
} else {
|
||||
var autoplay = true;
|
||||
}
|
||||
|
||||
// Slide speed
|
||||
var speed = 7000;
|
||||
|
||||
// Gallery slider
|
||||
$carousel.imagesLoaded( function() {
|
||||
$carousel.slick( {
|
||||
autoplay: autoplay,
|
||||
autoplaySpeed: speed,
|
||||
prevArrow: '<button type="button" class="slick-prev"><span class="fa fa-angle-left"></span></button>',
|
||||
nextArrow: '<button type="button" class="slick-next"><span class="fa fa-angle-right"></span></button>',
|
||||
rtl: rtl,
|
||||
} );
|
||||
} );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Superfish menus
|
||||
oceanwpSuperFish();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
SUPERFISH MENUS
|
||||
============================================== */
|
||||
function oceanwpSuperFish() {
|
||||
"use strict"
|
||||
|
||||
// Return if vertical header style
|
||||
if ( $j( '#site-header' ).hasClass( 'vertical-header' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$j( 'ul.sf-menu' ).superfish( {
|
||||
delay: 600,
|
||||
animation: {
|
||||
opacity: 'show'
|
||||
},
|
||||
animationOut: {
|
||||
opacity: 'hide'
|
||||
},
|
||||
speed: 'fast',
|
||||
speedOut: 'fast',
|
||||
cssArrows: false,
|
||||
disableHI: false,
|
||||
} );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
// On ready
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Vertical header style
|
||||
oceanwpVerticalHeader();
|
||||
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
VERTICAL HEADER STYLE
|
||||
============================================== */
|
||||
function oceanwpVerticalHeader() {
|
||||
"use strict"
|
||||
|
||||
// Return if no vertical header style
|
||||
if ( ! $j( '#site-header' ).hasClass( 'vertical-header' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Vars
|
||||
var $siteHeader = $j( '#site-header.vertical-header #site-header-inner' ),
|
||||
$hasChildren = $j( '#site-header.vertical-header li.menu-item-has-children' );
|
||||
|
||||
// Add dropdown toggle (plus)
|
||||
$hasChildren.children( 'a' ).append( '<span class="dropdown-toggle"></span>' );
|
||||
|
||||
// Toggle dropdowns
|
||||
var $dropdownTarget = $j( '.dropdown-toggle' );
|
||||
|
||||
// Check localization
|
||||
if ( oceanwpLocalize.verticalHeaderTarget == 'link' ) {
|
||||
$dropdownTarget = $j( '#site-header.vertical-header li.menu-item-has-children > a' );
|
||||
}
|
||||
|
||||
// Add toggle click event
|
||||
$dropdownTarget.on( 'tap click', function() {
|
||||
|
||||
// Define toggle vars
|
||||
if ( oceanwpLocalize.verticalHeaderTarget == 'link' ) {
|
||||
var $toggleParentLi = $j( this ).parent( 'li' );
|
||||
} else {
|
||||
var $toggleParentLink = $j( this ).parent( 'a' ),
|
||||
$toggleParentLi = $toggleParentLink.parent( 'li' );
|
||||
}
|
||||
|
||||
// Get parent items and dropdown
|
||||
var $allParentLis = $toggleParentLi.parents( 'li' ),
|
||||
$dropdown = $toggleParentLi.children( 'ul' );
|
||||
|
||||
// Toogle items
|
||||
if ( ! $toggleParentLi.hasClass( 'active' ) ) {
|
||||
$hasChildren.not( $allParentLis ).removeClass( 'active' ).children( 'ul' ).slideUp( 'fast' );
|
||||
$toggleParentLi.addClass( 'active' ).children( 'ul' ).slideDown( 'fast', function() {
|
||||
$siteHeader.getNiceScroll().resize();
|
||||
} );
|
||||
} else {
|
||||
$toggleParentLi.removeClass( 'active' ).children( 'ul' ).slideUp( 'fast', function() {
|
||||
$siteHeader.getNiceScroll().resize();
|
||||
} );
|
||||
}
|
||||
|
||||
// Return false
|
||||
return false;
|
||||
|
||||
} );
|
||||
|
||||
// Scrollbar
|
||||
if ( $siteHeader.length
|
||||
&& ! navigator.userAgent.match( /(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/ ) ) {
|
||||
$siteHeader.niceScroll( {
|
||||
autohidemode : false,
|
||||
cursorborder : 0,
|
||||
cursorborderradius : 0,
|
||||
cursorcolor : 'transparent',
|
||||
cursorwidth : 0,
|
||||
horizrailenabled : false,
|
||||
mousescrollstep : 40,
|
||||
scrollspeed : 60,
|
||||
zindex : 100005,
|
||||
} );
|
||||
}
|
||||
|
||||
// Open/Close header
|
||||
$j( 'a.vertical-toggle' ).on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
if ( ! $j( 'body' ).hasClass( 'vh-opened' ) ) {
|
||||
|
||||
$j( 'body' ).addClass( 'vh-opened' );
|
||||
$j( this ).find( '.hamburger' ).addClass( 'is-active' );
|
||||
|
||||
} else {
|
||||
|
||||
$j( 'body' ).removeClass( 'vh-opened' );
|
||||
$j( this ).find( '.hamburger' ).removeClass( 'is-active' );
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user