');
design_one_title_xl.addClass('design_one_title_medium');
design_one_title_xl.append(h2);
design_one.append(design_one_title_xl);
li.append(design_one);
g_list.append(li);
}
}
setTimeout(function () {
if (document.querySelector(".metink-container") !== null) {
var flip2 = new FlipSlider({
startIndex: 0,
container: document.querySelector(".metink-container"),
time: 3000
});
}
}, 1500);
});
}
function searchOnEnter(event) {
checkEnterPressed(this, event);
event.cancelBubble = true;
if (event.stopPropagation) event.stopPropagation();
}
function checkEnterPressed(obj, event) {
if (event.keyCode === 13) {
document.getElementById('search-submit').click();
}
}
$(document).ready(function () {
/*if (document.getElementById('search-submit')) {
var searchForm = document.getElementById('search-form')
var searchSubmit = document.getElementById('search-submit');
let s_elem = searchForm.querySelector('#input-search');
let dt_from_elem = searchForm.querySelector('#input-date-from');
let dt_to_elem = searchForm.querySelector('#input-date-to');
s_elem.onkeypress = searchOnEnter;
dt_from_elem.onkeypress = searchOnEnter;
dt_to_elem.onkeypress = searchOnEnter;
searchSubmit.addEventListener("click", function (e) {
e.preventDefault();
e.stopPropagation();
let s = searchForm.querySelector('#input-search').value;
let cat = searchForm.querySelector('#select-category').value;
let usr = searchForm.querySelector('#select-users').value;
let dt_from = searchForm.querySelector('#input-date-from').value;
let dt_to = searchForm.querySelector('#input-date-to').value;
let hasArgs = false;
if (!s) {
s = 's';
}
if (cat || usr || dt_from || dt_to) {
hasArgs = true;
}
let args = (cat ? 'cat=' + cat + '&' : '') + (usr ? 'usr=' + usr + '&' : '') + (dt_to ? 'dt_to=' + dt_to + '&' : '') + (dt_from ? 'dt_from=' + dt_from + '&' : '');
if (args) {
args = args.slice(0, -1);
}
if (s || hasArgs) {
document.location.href = "/search/" + s + "/" + (hasArgs ? "?" + args : '');
}
}, false);
}*/
document.querySelector(".side-primary-menu .search-holder-wrapper input").addEventListener("keyup", function (event) {
event.preventDefault();
if (event.keyCode === 13) {
window.location = "/search/" + this.value + '/';
}
});
var mouse_is_inside = false;
var favourite_list = $("
");
favourite_list.addClass("sub-menu");
/*if (getCookie("kath-m")) {
$(".user-menu-trigger span").html("ΛΟΓΑΡΙΑΣΜΟΣ");
}
else {
$(".user-menu-trigger span").html("SUBSCRIPTIONS");
}*/
/*$(".user-menu-trigger span").html("SUBSCRIPTIONS");*/
$(".favorite-trigger").addClass('menu-item-has-children').append(favourite_list);
if (localStorage.favourites) {
fav = JSON.parse(localStorage.favourites);
for (let fav_item of Object.values(fav)) {
console.log(fav_item);
var favourite_item = $("
");
favourite_item.append("
" + fav_item.title + " ");
favourite_list.append(favourite_item);
}
}
/*if (window.location.pathname === '/') {
$.get("https://www.ekathimerini.com/infeeds/weather/weather_cache.txt", function (data, status) {
var woeid = '946738';
if (localStorage.weather) {
woeid = localStorage.weather;
}
var data = JSON.parse(data);
var city = data[woeid];
/!*$(".weather-city").html(forecast.location.city);*!/
$(".head-weather a").attr('href', city.url);
$(".head-weather span.weather-city").html(city.title);
$(".head-weather span.temperature").html(city.temperature + " °C");
$(".head-weather span.w_code").addClass("w_code_" + city.class);
});
$(document).on('click', ".add-weather", function () {
updateWeatherBtn($(this));
});
}*/
var side_menu_touchmoved;
$(document).on('click touchend', "nav.side-primary-menu ul li.menu-item-has-children", function (e) {
if (side_menu_touchmoved != true) {
e.stopPropagation();
e.preventDefault();
if ($(e.target).hasClass('menu-item-has-children')) {
if ($(this).find(".sub-menu")) {
$(this).find(".sub-menu").toggleClass("sub-active");
}
} else if ($(e.target).is('a')) {
document.location.href = $(e.target).attr('href');
} else {
document.location.href = $(e.target).find('a').attr('href');
}
}
}).on('touchmove', function (e) {
side_menu_touchmoved = true;
}).on('touchstart', function () {
side_menu_touchmoved = false;
});
function updateWeatherBtn(elem) {
$(".add-weather").removeClass('weather_added');
$(".add-weather").html("+");
$(".add-weather.add-weather-main").html("Ορισμός ώς πόλη μου");
if (elem.hasClass('weather_added')) {
localStorage.removeItem("weather");
elem.removeClass('weather_added');
if (elem.hasClass('add-weather-main')) {
elem.html("Ορισμός ώς πόλη μου");
} else {
elem.html("+");
}
} else {
localStorage.setItem("weather", elem.attr("data-id"));
elem.addClass('weather_added');
if (elem.hasClass('add-weather-main')) {
elem.html("Αφαίρεση");
} else {
elem.html("-");
}
}
}
$(document).on('click', "body.single-post [id^=post-] img:not(.exclude-gallery)", function (e) {
var img_arr = [];
var nx_img = $(this).attr('data-nxsrc');
if (typeof nx_img === 'undefined' || nx_img === false) {
nx_img = $(this).attr("src");
}
var current_img = nx_img;
img_arr.push({
"src": nx_img,
"type": 'image'
});
$("body.single-post [id^=post-] img:not(.exclude-gallery)").each(function (index) {
var nx_img = $(this).attr('data-nxsrc');
if (typeof nx_img === 'undefined' || nx_img === false) {
nx_img = $(this).attr("src");
}
if (nx_img != current_img) {
img_arr.push({
"src": nx_img,
"type": 'image'
});
}
}).promise().done(function () {
$.fancybox.open(img_arr, {
loop: true
});
});
});
$(document).on('click', "#paperfront", function (e) {
nx_img = $(this).attr("data-nxsrc");
$.fancybox.open([{
"src": nx_img,
"type": 'image'
}], {
loop: true
});
});
$("body.home .sticky-logo").click(function (e) {
e.preventDefault();
$("html, body").animate({scrollTop: 0}, 800);
return true;
});
$(document).on('click', ".bookmark-add", function () {
var fav_ids;
var fav = {};
var fav_data = {title: $(this).attr("data-title"), permalink: $(this).attr("data-permalink")};
var fav_id = $(this).attr("data-id");
if (localStorage.favourites) {
fav = JSON.parse(localStorage.favourites);
}
fav[fav_id] = fav_data;
console.log(fav);
localStorage.setItem("favourites", JSON.stringify(fav));
});
if (window.matchMedia("(max-width: 768px)").matches) {
$("#main-user-nav, #main-sections-nav").css("top", $(".top-nav").offset().top + $(".top-nav").height());
}
$(window).scroll(function () {
if (window.matchMedia("(max-width: 768px)").matches) {
if ($("header").hasClass("sticky")) {
$("#main-user-nav, #main-sections-nav").css("top", $(".top-nav").height());
} else {
$("#main-user-nav, #main-sections-nav").css("top", $(".top-nav").offset().top + $(".top-nav").height());
}
} else {
$("#main-user-nav, #main-sections-nav").css("top", 0);
}
});
$(window).resize(function () {
if (window.matchMedia("(max-width: 768px)").matches) {
if ($("header").hasClass("sticky")) {
$("#main-user-nav, #main-sections-nav").css("top", $(".top-nav").height());
} else {
$("#main-user-nav, #main-sections-nav").css("top", $(".top-nav").offset().top + $(".top-nav").height());
}
if (!$("#main-user-nav").hasClass("menu-active")) {
$("#main-user-nav").css("right", -$("#main-sections-nav").width());
}
if (!$("#main-sections-nav").hasClass("menu-active")) {
$("#main-sections-nav").css("left", -$("#main-sections-nav").width());
}
if ($("#main-sections-nav").hasClass("menu-active") || $("#main-user-nav").hasClass("menu-active")) {
$("#content-wrap").css({"right": 0, "left": 0});
$("body").addClass("menu-active");
}
} else {
$("#main-user-nav, #main-sections-nav").css("top", 0);
$("body").removeClass("menu-active");
}
});
/* $('.gnomes-posts').slimScroll({
height: '366px'
});*/
/*if (window.innerWidth > 768) {
$('.latest_news_widget').slimScroll({
height: 'auto',
size: '10px',
railVisible: true,
alwaysVisible: true
});
}*/
/*$('.atzenta_widget').slimScroll({
height: 'auto',
size: '10px',
railVisible: true,
alwaysVisible: true
});*/
/*$('.gastronomos_widget').slimScroll({
height: 'auto',
size: '10px',
railVisible: true,
alwaysVisible: true
});*/
/*
$('#main-sections-nav').hover(function () {
mouse_is_inside = true;
}, function () {
mouse_is_inside = false;
});
$("html").mouseup(function (e) {
if (!mouse_is_inside)
{
if (window.matchMedia("(min-width: 769px)").matches) {
$("#main-sections-nav").animate({
left: -$("#main-sections-nav").width(),
opacity: 0
}, {duration: 300, queue: false});
$("#main-sections-nav").removeClass("menu-active");
$("#main-sections-nav").css("opacity", 0).removeClass('nav-shadow');
$(".hamburger--spin").removeClass("is-active");
} else {
}
}
}); */
$(document).mouseup(function (e) {
var container = $("#main-sections-nav");
if (!$(e.target).is('[class^="hamburger"]') && !container.is(e.target) && container.has(e.target).length === 0) {
if (window.matchMedia("(min-width: 769px)").matches) {
$("#main-sections-nav").animate({
left: -$("#main-sections-nav").width(),
opacity: 0
}, {duration: 300, queue: false});
$("#main-sections-nav").removeClass("menu-active");
$("#main-sections-nav").css("opacity", 0).removeClass('nav-shadow');
$(".hamburger--spin").removeClass("is-active");
}
}
});
$(".hamburger").click(function () {
if (!$("#main-sections-nav").hasClass("menu-active")) {
$("#main-sections-nav").css("opacity", 0).removeClass('nav-shadow');
if (window.matchMedia("(min-width: 769px)").matches) {
/*$("#content-wrap").animate({
left: $("#main-sections-nav").width()
}, {duration: 300, queue: false});*/
} else {
$("body").addClass("menu-active");
}
$("#main-sections-nav").animate({
left: 0,
opacity: 1
}, {duration: 300, queue: false});
$("#main-sections-nav").addClass("menu-active").addClass('nav-shadow');
} else {
if (window.matchMedia("(min-width: 769px)").matches) {
/* $("#content-wrap").animate({
left: 0,
right: "auto"
}, {duration: 300, queue: false});*/
} else {
$("body").removeClass("menu-active");
}
$("#main-sections-nav").animate({
left: -$("#main-sections-nav").width(),
opacity: 0
}, {duration: 300, queue: false});
$("#main-sections-nav").removeClass("menu-active");
}
if ($("#main-user-nav").hasClass("menu-active")) {
$("#main-user-nav").animate({
right: -$("#main-user-nav").width(),
opacity: 0
}, {duration: 350, queue: false});
$("#main-user-nav").removeClass("menu-active");
}
});
/*
$(".user-menu-trigger").click(function () {
if (!$("#main-user-nav").hasClass("menu-active")) {
$("#main-user-nav").css("opacity", 0);
if (window.matchMedia("(min-width: 769px)").matches) {
$("#content-wrap").animate({
left: -$("#main-user-nav").width()
}, {duration: 300, queue: false});
} else {
$("body").addClass("menu-active");
}
$("#main-user-nav").css("opacity", 0);
$("#main-user-nav").animate({
right: 0,
opacity: 1
}, {duration: 300, queue: false});
$("#main-user-nav").addClass("menu-active");
} else {
if (window.matchMedia("(min-width: 769px)").matches) {
$("#content-wrap").animate({
left: 0
}, {duration: 300, queue: false});
} else {
$("body").removeClass("menu-active");
}
$("#main-user-nav").animate({
right: -$("#main-user-nav").width(),
opacity: 0
}, {duration: 300, queue: false});
$("#main-user-nav").removeClass("menu-active");
}
if ($("#main-sections-nav").hasClass("menu-active")) {
$("#main-sections-nav").animate({
left: -$("#main-sections-nav").width(),
opacity: 0
}, {duration: 350, queue: false});
$("#main-sections-nav").removeClass("menu-active");
$(".hamburger").removeClass("is-active");
}
});
*/
$(".search-trigger").click(function () {
if ($(".header-search").hasClass("header-search-active")) {
$(".header-search").removeClass("header-search-active");
} else {
$(".header-search").addClass("header-search-active");
$(".search-input").focus();
}
});
var forEach = function (t, o, r) {
if ("[object Object]" === Object.prototype.toString.call(t)) for (var c in t) Object.prototype.hasOwnProperty.call(t, c) && o.call(r, t[c], c, t); else for (var e = 0, l = t.length; l > e; e++) o.call(r, t[e], e, t)
};
var hamburgers = document.querySelectorAll(".hamburger");
if (hamburgers.length > 0) {
forEach(hamburgers, function (hamburger) {
hamburger.addEventListener("click", function () {
this.classList.toggle("is-active");
}, false);
});
}
if ($('.datepicker_from').length > 0) {
$('.datepicker_from, .datepicker_to').datepicker({
dateFormat: 'dd-mm-yy',
startDate: '-3d'
});
}
if (!document.querySelector('#no-slick-mp')) {
if ($('.article-slider').length) {
var sl_article_slider = function () {
document.removeEventListener("scroll", sl_article_slider);
setTimeout(function () {
$('.article-slider').slick({
infinite: true,
dots: false,
slidesToShow: 1,
slidesToScroll: 1,
prevArrow: '
Previous ',
nextArrow: '
Next '
}).on('click, afterChange', function (event, slick, direction) {
setTimeout(function () {
window.QuantBlockScroll = true;
document.dispatchEvent(new CustomEvent('scroll'));
//// TRIGGER SCROLL
}, 0);
});
}, 0)
};
document.addEventListener("scroll", sl_article_slider);
}
if ($('.header-articles .slick-slider').length) {
var sl_ha_slider = function () {
document.removeEventListener("scroll", sl_ha_slider);
setTimeout(function () {
$('.header-articles .slick-slider').slick({
infinite: false,
dots: false,
slidesToShow: 4,
slidesToScroll: 1,
prevArrow: '
Previous ',
nextArrow: '
Next ',
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 2,
slidesToScroll: 1,
infinite: true,
dots: false,
autoplay: true,
autoplaySpeed: 3000
}
},
{
breakpoint: 600,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
infinite: true,
autoplay: true,
autoplaySpeed: 3000
}
}
]
});
}, 0)
};
document.addEventListener("scroll", sl_ha_slider);
}
if ($('.mini-slider').length) {
var sl_ms_slider = function () {
document.removeEventListener("scroll", sl_ms_slider);
setTimeout(function () {
$('.mini-slider').slick({
infinite: false,
dots: false,
slidesToShow: 4,
slidesToScroll: 1,
prevArrow: '
Previous ',
nextArrow: '
Next ',
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 2,
slidesToScroll: 1,
infinite: true,
dots: false,
autoplay: true,
autoplaySpeed: 3000
}
},
{
breakpoint: 600,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
infinite: true,
autoplay: true,
autoplaySpeed: 3000
}
}
]
});
}, 0)
};
document.addEventListener("scroll", sl_ms_slider);
}
// slick_video
if ($('.media-wrapper').length) {
var sl_mw_slider = function () {
document.removeEventListener("scroll", sl_mw_slider);
setTimeout(function () {
$('.media-wrapper').slick({
slidesToShow: 1,
slidesToScroll: 1,
autoplay: false,
dots: false,
infinite: true,
adaptiveHeight: false,
arrows: true,
prevArrow: '
Previous ',
nextArrow: '
Next ',
}).on('click, afterChange', function (event, slick, direction) {
setTimeout(function () {
window.QuantBlockScroll = true;
document.dispatchEvent(new CustomEvent('scroll'));
//// TRIGGER SCROLL
}, 0);
});
}, 0)
};
document.addEventListener("scroll", sl_mw_slider);
}
// Gnomes anagnoston
if ($('.opinions').length) {
var sl_op_slider = function () {
document.removeEventListener("scroll", sl_op_slider);
setTimeout(function () {
$('.opinions').slick({
infinite: true,
dots: false,
slidesToShow: 4,
slidesToScroll: 1,
variableWidth: true,
prevArrow: '
Previous ',
nextArrow: '
Next ',
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 3,
slidesToScroll: 1,
infinite: true,
dots: false
}
},
{
breakpoint: 768,
settings: {
slidesToShow: 2,
slidesToScroll: 1
}
},
{
breakpoint: 481,
settings: {
arrows: false,
slidesToShow: 1,
slidesToScroll: 1
}
}
]
}).on('click, afterChange', function (event, slick, direction) {
setTimeout(function () {
window.QuantBlockScroll = true;
document.dispatchEvent(new CustomEvent('scroll'));
//// TRIGGER SCROLL
}, 0);
});
}, 0)
};
document.addEventListener("scroll", sl_op_slider);
}
// Gnomes Apopseis
if ($('.gnomes-apopseis .container').length) {
var sl_apo_slider = function () {
document.removeEventListener("scroll", sl_apo_slider);
setTimeout(function () {
$('.gnomes-apopseis .container').slick({
infinite: true,
dots: false,
slidesToShow: 5,
slidesToScroll: 1,
prevArrow: '
Previous ',
nextArrow: '
Next ',
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 3,
slidesToScroll: 1,
}
},
{
breakpoint: 600,
settings: {
slidesToShow: 2,
slidesToScroll: 1
}
},
{
breakpoint: 481,
settings: {
width: 173,
arrows: false,
centerMode: true,
slidesToShow: 1,
slidesToScroll: 1,
variableWidth: true,
variableHeight: false,
}
}
]
}).on('click, afterChange', function (event, slick, direction) {
setTimeout(function () {
window.QuantBlockScroll = true;
document.dispatchEvent(new CustomEvent('scroll'));
//// TRIGGER SCROLL
}, 0);
});
}, 0)
};
document.addEventListener("scroll", sl_apo_slider);
}
// cartoon
if ($('.cartoon-inner').length) {
var sl_foto_slider = function () {
document.removeEventListener("scroll", sl_foto_slider);
setTimeout(function () {
$('.cartoon-inner').slick({
centerMode: true,
infinite: true,
slidesToShow: 1,
slidesToScroll: 1,
centerPadding: '80px',
dots: true,
prevArrow: '
Previous ',
nextArrow: '
Next ',
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
infinite: true,
dots: false
}
},
{
breakpoint: 481,
settings: {
centerPadding: '0px',
variableWidth: false,
variableHeight: false,
slidesToShow: 1,
slidesToScroll: 1
}
}
]
}).on('click, afterChange', function (event, slick, direction) {
setTimeout(function () {
window.QuantBlockScroll = true;
document.dispatchEvent(new CustomEvent('scroll'));
//// TRIGGER SCROLL
}, 0);
});
}, 0)
};
document.addEventListener("scroll", sl_foto_slider);
}
// skitsa
if ($('.sketch-container').length) {
var sl_ske_slider = function () {
document.removeEventListener("scroll", sl_ske_slider);
setTimeout(function () {
$('.sketch-container').slick({
infinite: true,
dots: false,
slidesToShow: 1,
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 4000,
prevArrow: '
Previous ',
nextArrow: '
Next ',
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
infinite: true,
dots: false
}
},
{
breakpoint: 600,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
]
}).on('click, afterChange', function (event, slick, direction) {
setTimeout(function () {
window.QuantBlockScroll = true;
document.dispatchEvent(new CustomEvent('scroll'));
//// TRIGGER SCROLL
}, 0);
});
}, 0)
};
document.addEventListener("scroll", sl_ske_slider);
}
}
$('.category-cartoon .media-wrapper').on('beforeChange', function (event, slick, currentSlide, nextSlide) {
var imgs = $('.category-cartoon .media-wrapper .image-item:not(.slick-cloned)');
if (imgs.length > 0) {
var title = imgs.eq(nextSlide).find('img').attr("title");
$("h1.entry-title").html(title);
}
});
if (window.matchMedia('(max-width: 991px)').matches) {
$('div.header-articles.home-3').insertBefore(".horizontal-ad");
$('div.header-articles.home-3').show();
}
/*$(function () {
$('.user-signin-mob').magnificPopup({
type: 'inline',
preloader: false,
modal: true
});
$(document).on('click', '.popup-modal-dismiss', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
});*/
/* $(function () {
$('.newsletter-trigger, .newsletter-modal-trigger a').magnificPopup({
type: 'inline',
preloader: false,
modal: true
});
$(document).on('click', '.popup-modal-dismiss', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
});*/
$(document).on('click', '.scroll-top-trigger', function (e) {
e.preventDefault();
currentYOffset = self.pageYOffset;
initYOffset = currentYOffset;
var intervalId = setInterval(function () {
currentYOffset -= initYOffset * 0.05;
document.body.scrollTop = currentYOffset;
document.documentElement.scrollTop = currentYOffset;
if (self.pageYOffset == 0) {
clearInterval(intervalId);
}
}, 20);
});
$(document).on('click', '.feed-latest', function (e) {
e.preventDefault();
$(".feed-latest").addClass('feed-active');
$(".feed-popular").removeClass('feed-active');
$(".news_popular").hide();
$(".news_latest").show();
if (window.innerWidth > 768) {
$(".latest_news_widget").scrollTop(0).slimScroll({scroll: '0'});
}
});
$(document).on('click', '.feed-popular', function (e) {
e.preventDefault();
$(".feed-popular").addClass('feed-active');
$(".feed-latest").removeClass('feed-active');
$(".news_latest").hide();
$(".news_popular").show();
if (window.innerWidth > 768) {
$(".latest_news_widget").scrollTop(0).slimScroll({scroll: '0'});
}
});
$("#loginform").submit(function (e) {
if ($("#user_pass").length > 0) {
return true;
} else {
e.preventDefault();
var fieldset_pwd = $('
');
var label_pwd = $('');
var div_float = $('');
var div_wrapper = $('
');
var input_pwd = $('
');
label_pwd.addClass('your-email').append("Κωδικός");
input_pwd.attr({
type: 'password',
id: 'user_pass',
autocapitalize: 'off',
autocomplete: 'on',
maxlength: '64',
name: 'pwd'
}).addClass("input-email");
div_wrapper.addClass('email-wrapper').append(input_pwd);
div_float.addClass('float-clear').append(div_wrapper);
fieldset_pwd.append(label_pwd);
fieldset_pwd.append(div_float);
fieldset_pwd.insertAfter($("#loginform fieldset"));
return false;
}
});
});
// When the user scrolls the page, execute myFunction
window.onscroll = function () {
windowScroll()
};
// Get the header
var masthead = document.getElementById("masthead");
var header = document.getElementById("header");
var newletter = document.querySelector(".newsletter-subscribe");
var to_top = document.querySelector(".to-top");
// Get the offset position of the navbar
var sticky = masthead.offsetTop + masthead.offsetHeight;
var top_scroll_offset = ($(window).height() * 2);
// Add the sticky class to the header when you reach its scroll position. Remove "sticky" when you leave the scroll position
function windowScroll() {
if (window.pageYOffset > sticky) {
header.classList.add("sticky-title");
//newletter.classList.add("sticky-footer");
} else {
header.classList.remove("sticky-title");
//newletter.classList.remove("sticky-footer");
}
if (window.pageYOffset > top_scroll_offset) {
to_top.classList.add("sticky-footer");
} else {
to_top.classList.remove("sticky-footer");
}
}
var stickyHeaders = (function () {
var $window = $(window),
$stickies;
var load = function (stickies) {
if (typeof stickies === "object" && stickies instanceof jQuery && stickies.length > 0) {
$stickies = stickies.each(function () {
var $thisSticky = $(this).wrap('
');
$thisSticky
.data('originalPosition', $thisSticky.offset().top)
.data('originalHeight', $thisSticky.outerHeight())
.parent()
.height($thisSticky.outerHeight());
});
$window.off("scroll.stickies").on("scroll.stickies", function () {
_whenScrolling();
});
}
};
var _whenScrolling = function () {
$stickies.each(function (i) {
var $thisSticky = $(this),
$stickyPosition = $thisSticky.data('originalPosition');
if ($stickyPosition <= $window.scrollTop()) {
var $nextSticky = $stickies.eq(i + 1),
$nextStickyPosition = $nextSticky.data('originalPosition') - $thisSticky.data('originalHeight');
$thisSticky.addClass("fixed");
if ($nextSticky.length > 0 && ($thisSticky.offset().top - 105) >= $nextStickyPosition) {
$thisSticky.addClass("absolute").css("top", $nextStickyPosition);
}
} else {
var $prevSticky = $stickies.eq(i - 1);
$thisSticky.removeClass("fixed");
if ($prevSticky.length > 0 && $window.scrollTop() <= $thisSticky.data('originalPosition') - $thisSticky.data('originalHeight')) {
$prevSticky.removeClass("absolute").removeAttr("style");
}
}
});
};
return {
load: load
};
})();
$(function () {
stickyHeaders.load($(".stickyBar"));
});
function getCookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
} else {
begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1) {
end = dc.length;
}
}
// because unescape has been deprecated, replaced with decodeURI
//return unescape(dc.substring(begin + prefix.length, end));
return decodeURI(dc.substring(begin + prefix.length, end));
}
function FlipSlider(options) {
// Private Vars
var container = options.container,
startSlideIndex = options.startIndex || 0,
slider = container.querySelector(".flip"),
slides = container.querySelectorAll(".flip-slide"),
slide_txts = container.querySelectorAll(".flip-text"),
timeout,
frontSlide,
frontSlideTxt,
backSlideTxt,
backSlide;
// == public functions == //
//Next flip
this.nextFlip = function () {
doFlip(1);
};
//previous flip
this.prevFlip = function () {
doFlip(-1);
};
// == private functions == //
// flip slides
function doFlip(dir) {
if (slides.length > 1) {
if (!container.querySelector(".animate")) {
slider.classList.add("animate");
if (slide_txts.length > 0) {
backSlideTxt = findBackTxt(dir);
backSlideTxt.classList.add("back");
}
if (dir == -1) {
slider.classList.add("animateL");
}
frontSlide = slider.querySelector(".front");
if (slide_txts.length > 0) {
frontSlideTxt = container.querySelector(".front");
}
backSlide = findBack(dir);
backSlide.classList.add("back");
timeout = setTimeout(function () {
resetSlides();
clearTimeout(timeout);
}, 600);
}
}
}
// reset slides on completion
function resetSlides() {
if (slide_txts.length > 0) {
frontSlideTxt = container.querySelector(".flip-text.front");
backSlideTxt = container.querySelector(".flip-text.back");
if (backSlideTxt) {
backSlideTxt.classList.add("front");
backSlideTxt.classList.remove("back");
}
if (frontSlideTxt) {
frontSlideTxt.classList.remove("front");
}
}
frontSlide = slider.querySelector(".front");
backSlide = slider.querySelector(".back");
if (backSlide) {
backSlide.classList.add("front");
backSlide.classList.remove("back");
}
if (frontSlide) {
frontSlide.classList.remove("front");
}
slider.classList.remove("animate");
slider.classList.remove("animateL");
}
// find slide to set it back-flip
function findBack(dir) {
var frontIndex,
target,
slideCount;
slides = slider.querySelectorAll(".flip-slide");
slideCount = slides.length;
for (var i = 0; i < slideCount; i++) {
if (slides[i].classList.contains("front")) {
frontIndex = i;
}
}
if (dir == -1) {
target = frontIndex < 1 ? slides[slideCount - 1] : slides[frontIndex - 1];
} else {
target = (frontIndex + 1) < slideCount ? slides[frontIndex + 1] : slides[0];
}
return target;
}
function findBackTxt(dir) {
var frontIndex,
target,
slideCount;
slide_txts = container.querySelectorAll(".flip-text");
slideCount = slide_txts.length;
for (var i = 0; i < slideCount; i++) {
if (slide_txts[i].classList.contains("front")) {
frontIndex = i;
}
}
if (dir == -1) {
target = frontIndex < 1 ? slide_txts[slideCount - 1] : slide_txts[frontIndex - 1];
} else {
target = (frontIndex + 1) < slideCount ? slide_txts[frontIndex + 1] : slide_txts[0];
}
return target;
}
// Init
(function (instance) {
// Setting First Slide
startSlideIndex = startSlideIndex >= slides.length ? 0 : startSlideIndex;
slides[startSlideIndex].classList.add("front");
if (slide_txts.length > 0) {
slide_txts[startSlideIndex].classList.add("front");
}
// Event Bindings
/*nextBtn.onclick = instance.nextFlip;
PrevBtn.onclick = instance.prevFlip;*/
})(this);
setInterval(function () {
doFlip(1);
}, options.time);
}
window.addEventListener('DOMContentLoaded', (event) => {
const $mainMenu = $("#subMenu");
const $autoNav = $("#autoNav");
const $autoNavMore = $("#autoNavMore");
const $autoNavMoreList = $("#autoNavMoreList");
autoNavMore = () => {
let childNumber = 2;
if ($(window).width() >= 320) {
// GET MENU AND NAV WIDTH
const $menuWidth = $mainMenu.width();
const $autoNavWidth = $autoNav.width();
if ($autoNavWidth > $menuWidth) {
// CODE FIRES WHEN WINDOW SIZE GOES DOWN
$autoNav
.children(`li:nth-last-child(${childNumber})`)
.prependTo($autoNavMoreList);
autoNavMore();
} else {
// CODE FIRES WHEN WINDOW SIZE GOES UP
const $autoNavMoreFirst = $autoNavMoreList
.children("li:first-child")
.width();
// CHECK IF ITEM HAS ENOUGH SPACE TO PLACE IN MENU
if ($autoNavWidth + $autoNavMoreFirst < $menuWidth) {
$autoNavMoreList.children("li:first-child").insertBefore($autoNavMore);
}
}
if ($autoNavMoreList.children().length > 0) {
$autoNavMore.show();
childNumber = 2;
} else {
$autoNavMore.hide();
childNumber = 1;
}
}
};
// INIT
autoNavMore();
$(window).resize(autoNavMore);
});