Initial Commit
This commit is contained in:
109
public/front/js/script.js
Normal file
109
public/front/js/script.js
Normal file
@@ -0,0 +1,109 @@
|
||||
|
||||
( function ( $ ) {
|
||||
'use strict';
|
||||
|
||||
// Preloader js
|
||||
$( window ).on( 'load', function () {
|
||||
$( '.preloader' ).fadeOut( 100 );
|
||||
} );
|
||||
|
||||
|
||||
// Search Form Open
|
||||
$( '#searchOpen' ).on( 'click', function () {
|
||||
$( '.search-wrapper' ).addClass( 'open' );
|
||||
setTimeout( function () {
|
||||
$( '.search-box' ).focus();
|
||||
}, 400 );
|
||||
} );
|
||||
$( '#searchClose' ).on( 'click', function () {
|
||||
$( '.search-wrapper' ).removeClass( 'open' );
|
||||
} );
|
||||
|
||||
|
||||
// tab
|
||||
$( '.tab-content' ).find( '.tab-pane' ).each( function ( idx, item ) {
|
||||
var navTabs = $( this ).closest( '.code-tabs' ).find( '.nav-tabs' ),
|
||||
title = $( this ).attr( 'title' );
|
||||
navTabs.append( '<li class="nav-item"><a class="nav-link" href="#">' + title + '</a></li>' );
|
||||
} );
|
||||
|
||||
$( '.code-tabs ul.nav-tabs' ).each( function () {
|
||||
$( this ).find( 'li:first' ).addClass( 'active' );
|
||||
} );
|
||||
|
||||
$( '.code-tabs .tab-content' ).each( function () {
|
||||
$( this ).find( 'div:first' ).addClass( 'active' );
|
||||
} );
|
||||
|
||||
$( '.nav-tabs a' ).click( function ( e ) {
|
||||
e.preventDefault();
|
||||
var tab = $( this ).parent(),
|
||||
tabIndex = tab.index(),
|
||||
tabPanel = $( this ).closest( '.code-tabs' ),
|
||||
tabPane = tabPanel.find( '.tab-pane' ).eq( tabIndex );
|
||||
tabPanel.find( '.active' ).removeClass( 'active' );
|
||||
tab.addClass( 'active' );
|
||||
tabPane.addClass( 'active' );
|
||||
} );
|
||||
|
||||
|
||||
// Accordions
|
||||
$( '.collapse' ).on( 'shown.bs.collapse', function () {
|
||||
$( this ).parent().find( '.ti-plus' ).removeClass( 'ti-plus' ).addClass( 'ti-minus' );
|
||||
} ).on( 'hidden.bs.collapse', function () {
|
||||
$( this ).parent().find( '.ti-minus' ).removeClass( 'ti-minus' ).addClass( 'ti-plus' );
|
||||
} );
|
||||
|
||||
|
||||
|
||||
//easeInOutExpo Declaration
|
||||
jQuery.extend( jQuery.easing, {
|
||||
easeInOutExpo: function ( x, t, b, c, d ) {
|
||||
if ( t === 0 ) { return b; }
|
||||
if ( t === d ) { return b + c; }
|
||||
if ( ( t /= d / 2 ) < 1 ) { return c / 2 * Math.pow( 2, 10 * ( t - 1 ) ) + b; }
|
||||
return c / 2 * ( -Math.pow( 2, -10 * --t ) + 2 ) + b;
|
||||
}
|
||||
} );
|
||||
|
||||
// back to top button
|
||||
$( function () {
|
||||
const $btn = $( '#scrollTop' );
|
||||
if ( !$btn.length ) return;
|
||||
|
||||
$btn.on( 'click', function ( e ) {
|
||||
e.preventDefault();
|
||||
$( 'html, body' ).animate( { scrollTop: 0 }, 1500, 'easeInOutExpo' );
|
||||
} );
|
||||
} );
|
||||
//post slider
|
||||
$( '.post-slider' ).slick( {
|
||||
slidesToShow: 1,
|
||||
slidesToScroll: 1,
|
||||
autoplay: true,
|
||||
dots: false,
|
||||
arrows: true,
|
||||
prevArrow: '<button type=\'button\' class=\'prevArrow\'><i class=\'ti-angle-left\'></i></button>',
|
||||
nextArrow: '<button type=\'button\' class=\'nextArrow\'><i class=\'ti-angle-right\'></i></button>',
|
||||
fade: true,
|
||||
speed: 2500,
|
||||
cssEase: 'linear'
|
||||
} );
|
||||
|
||||
} )( jQuery );
|
||||
|
||||
|
||||
document.addEventListener( "DOMContentLoaded", function () {
|
||||
const shareButtons = document.querySelector( '.share-buttons' );
|
||||
if ( !shareButtons ) return;
|
||||
const stickyOffset = shareButtons.offsetTop;
|
||||
|
||||
window.addEventListener( 'scroll', function () {
|
||||
// if (window.pageYOffset > stickyOffset) {
|
||||
if ( window.scrollY > stickyOffset ) {
|
||||
shareButtons.classList.add( 'sticky-share-buttons' );
|
||||
} else {
|
||||
shareButtons.classList.remove( 'sticky-share-buttons' );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
Reference in New Issue
Block a user