first version
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
(function ($) {
|
||||
$.fn.countTo = function (options) {
|
||||
options = options || {};
|
||||
|
||||
return $(this).each(function () {
|
||||
// set options for current element
|
||||
var settings = $.extend(
|
||||
{},
|
||||
$.fn.countTo.defaults,
|
||||
{
|
||||
from: $(this).data("from"),
|
||||
to: $(this).data("to"),
|
||||
speed: $(this).data("speed"),
|
||||
refreshInterval: $(this).data("refresh-interval"),
|
||||
decimals: $(this).data("decimals")
|
||||
},
|
||||
options
|
||||
);
|
||||
|
||||
// how many times to update the value, and how much to increment the value on each update
|
||||
var loops = Math.ceil(settings.speed / settings.refreshInterval),
|
||||
increment = (settings.to - settings.from) / loops;
|
||||
|
||||
// references & variables that will change with each update
|
||||
var self = this,
|
||||
$self = $(this),
|
||||
loopCount = 0,
|
||||
value = settings.from,
|
||||
data = $self.data("countTo") || {};
|
||||
|
||||
$self.data("countTo", data);
|
||||
|
||||
// if an existing interval can be found, clear it first
|
||||
if (data.interval) {
|
||||
clearInterval(data.interval);
|
||||
}
|
||||
data.interval = setInterval(updateTimer, settings.refreshInterval);
|
||||
|
||||
// initialize the element with the starting value
|
||||
render(value);
|
||||
|
||||
function updateTimer() {
|
||||
value += increment;
|
||||
loopCount++;
|
||||
|
||||
render(value);
|
||||
|
||||
if (typeof settings.onUpdate == "function") {
|
||||
settings.onUpdate.call(self, value);
|
||||
}
|
||||
|
||||
if (loopCount >= loops) {
|
||||
// remove the interval
|
||||
$self.removeData("countTo");
|
||||
clearInterval(data.interval);
|
||||
value = settings.to;
|
||||
|
||||
if (typeof settings.onComplete == "function") {
|
||||
settings.onComplete.call(self, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function render(value) {
|
||||
var formattedValue = settings.formatter.call(self, value, settings);
|
||||
$self.html(formattedValue);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.countTo.defaults = {
|
||||
from: 0, // the number the element should start at
|
||||
to: 0, // the number the element should end at
|
||||
speed: 1000, // how long it should take to count between the target numbers
|
||||
refreshInterval: 100, // how often the element should be updated
|
||||
decimals: 0, // the number of decimal places to show
|
||||
formatter: formatter, // handler for formatting the value before rendering
|
||||
onUpdate: null, // callback method for every time the element is updated
|
||||
onComplete: null // callback method for when the element finishes updating
|
||||
};
|
||||
|
||||
function formatter(value, settings) {
|
||||
return value.toFixed(settings.decimals);
|
||||
}
|
||||
})(jQuery);
|
||||
|
||||
jQuery(function ($) {
|
||||
// custom formatting example
|
||||
$(".count-number").data("countToOptions", {
|
||||
formatter: function (value, options) {
|
||||
return value
|
||||
.toFixed(options.decimals)
|
||||
.replace(/\B(?=(?:\d{3})+(?!\d))/g, ",");
|
||||
}
|
||||
});
|
||||
|
||||
// start all the timers
|
||||
$(".timer").each(count);
|
||||
|
||||
function count(options) {
|
||||
var $this = $(this);
|
||||
options = $.extend({}, options || {}, $this.data("countToOptions") || {});
|
||||
$this.countTo(options);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,218 @@
|
||||
(function ($) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// Page loading animation
|
||||
$(window).on('load', function() {
|
||||
|
||||
$('#js-preloader').addClass('loaded');
|
||||
|
||||
});
|
||||
|
||||
|
||||
$(window).scroll(function() {
|
||||
var scroll = $(window).scrollTop();
|
||||
var box = $('.header-text').height();
|
||||
var header = $('header').height();
|
||||
|
||||
if (scroll >= box - header) {
|
||||
$("header").addClass("background-header");
|
||||
} else {
|
||||
$("header").removeClass("background-header");
|
||||
}
|
||||
})
|
||||
|
||||
var width = $(window).width();
|
||||
$(window).resize(function() {
|
||||
if (width > 767 && $(window).width() < 767) {
|
||||
location.reload();
|
||||
}
|
||||
else if (width < 767 && $(window).width() > 767) {
|
||||
location.reload();
|
||||
}
|
||||
})
|
||||
|
||||
const elem = document.querySelector('.event_box');
|
||||
const filtersElem = document.querySelector('.event_filter');
|
||||
if (elem) {
|
||||
const rdn_events_list = new Isotope(elem, {
|
||||
itemSelector: '.event_outer',
|
||||
layoutMode: 'masonry'
|
||||
});
|
||||
if (filtersElem) {
|
||||
filtersElem.addEventListener('click', function(event) {
|
||||
if (!matchesSelector(event.target, 'a')) {
|
||||
return;
|
||||
}
|
||||
const filterValue = event.target.getAttribute('data-filter');
|
||||
rdn_events_list.arrange({
|
||||
filter: filterValue
|
||||
});
|
||||
filtersElem.querySelector('.is_active').classList.remove('is_active');
|
||||
event.target.classList.add('is_active');
|
||||
event.preventDefault();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$('.owl-banner').owlCarousel({
|
||||
center: true,
|
||||
items:1,
|
||||
loop:true,
|
||||
nav: true,
|
||||
navText: ['<i class="fa fa-angle-left" aria-hidden="true"></i>','<i class="fa fa-angle-right" aria-hidden="true"></i>'],
|
||||
margin:30,
|
||||
responsive:{
|
||||
992:{
|
||||
items:1
|
||||
},
|
||||
1200:{
|
||||
items:1
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('.owl-testimonials').owlCarousel({
|
||||
center: true,
|
||||
items:1,
|
||||
loop:true,
|
||||
nav: true,
|
||||
navText: ['<i class="fa fa-angle-left" aria-hidden="true"></i>','<i class="fa fa-angle-right" aria-hidden="true"></i>'],
|
||||
margin:30,
|
||||
responsive:{
|
||||
992:{
|
||||
items:1
|
||||
},
|
||||
1200:{
|
||||
items:1
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Menu Dropdown Toggle
|
||||
if($('.menu-trigger').length){
|
||||
$(".menu-trigger").on('click', function() {
|
||||
$(this).toggleClass('active');
|
||||
$('.header-area .nav').slideToggle(200);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Menu elevator animation
|
||||
$('.scroll-to-section a[href*=\\#]:not([href=\\#])').on('click', function() {
|
||||
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
|
||||
var target = $(this.hash);
|
||||
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
|
||||
if (target.length) {
|
||||
var width = $(window).width();
|
||||
if(width < 767) {
|
||||
$('.menu-trigger').removeClass('active');
|
||||
$('.header-area .nav').slideUp(200);
|
||||
}
|
||||
$('html,body').animate({
|
||||
scrollTop: (target.offset().top) - 80
|
||||
}, 700);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
$(document).on("scroll", onScroll);
|
||||
|
||||
//smoothscroll
|
||||
$('.scroll-to-section a[href^="#"]').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
$(document).off("scroll");
|
||||
|
||||
$('.scroll-to-section a').each(function () {
|
||||
$(this).removeClass('active');
|
||||
})
|
||||
$(this).addClass('active');
|
||||
|
||||
var target = this.hash,
|
||||
menu = target;
|
||||
var target = $(this.hash);
|
||||
$('html, body').stop().animate({
|
||||
scrollTop: (target.offset().top) - 79
|
||||
}, 500, 'swing', function () {
|
||||
window.location.hash = target;
|
||||
$(document).on("scroll", onScroll);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function onScroll(event){
|
||||
var scrollPos = $(document).scrollTop();
|
||||
$('.nav a').each(function () {
|
||||
var currLink = $(this);
|
||||
var refElement = $(currLink.attr("href"));
|
||||
if (refElement.position().top <= scrollPos && refElement.position().top + refElement.height() > scrollPos) {
|
||||
$('.nav ul li a').removeClass("active");
|
||||
currLink.addClass("active");
|
||||
}
|
||||
else{
|
||||
currLink.removeClass("active");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Page loading animation
|
||||
$(window).on('load', function() {
|
||||
if($('.cover').length){
|
||||
$('.cover').parallax({
|
||||
imageSrc: $('.cover').data('image'),
|
||||
zIndex: '1'
|
||||
});
|
||||
}
|
||||
|
||||
$("#preloader").animate({
|
||||
'opacity': '0'
|
||||
}, 600, function(){
|
||||
setTimeout(function(){
|
||||
$("#preloader").css("visibility", "hidden").fadeOut();
|
||||
}, 300);
|
||||
});
|
||||
});
|
||||
|
||||
const dropdownOpener = $('.main-nav ul.nav .has-sub > a');
|
||||
|
||||
// Open/Close Submenus
|
||||
if (dropdownOpener.length) {
|
||||
dropdownOpener.each(function () {
|
||||
var _this = $(this);
|
||||
|
||||
_this.on('tap click', function (e) {
|
||||
var thisItemParent = _this.parent('li'),
|
||||
thisItemParentSiblingsWithDrop = thisItemParent.siblings('.has-sub');
|
||||
|
||||
if (thisItemParent.hasClass('has-sub')) {
|
||||
var submenu = thisItemParent.find('> ul.sub-menu');
|
||||
|
||||
if (submenu.is(':visible')) {
|
||||
submenu.slideUp(450, 'easeInOutQuad');
|
||||
thisItemParent.removeClass('is-open-sub');
|
||||
} else {
|
||||
thisItemParent.addClass('is-open-sub');
|
||||
|
||||
if (thisItemParentSiblingsWithDrop.length === 0) {
|
||||
thisItemParent.find('.sub-menu').slideUp(400, 'easeInOutQuad', function () {
|
||||
submenu.slideDown(250, 'easeInOutQuad');
|
||||
});
|
||||
} else {
|
||||
thisItemParent.siblings().removeClass('is-open-sub').find('.sub-menu').slideUp(250, 'easeInOutQuad', function () {
|
||||
submenu.slideDown(250, 'easeInOutQuad');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
})(window.jQuery);
|
||||
Vendored
+12
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user