$(document).ready(function () { var poglavje = $("body").attr("class"); if (poglavje == "page-index") { $(".head-poglavja ul li").eq(0).find("a").addClass("active"); } else if (poglavje == "page-poglavje2") { $(".head-poglavja ul li").eq(1).find("a").addClass("active"); } else if (poglavje == "page-poglavje3") { $(".head-poglavja ul li").eq(2).find("a").addClass("active"); } else if (poglavje == "page-poglavje4") { $(".head-poglavja ul li").eq(3).find("a").addClass("active"); } $(window).load(function() { var poglavje = $("body").attr("class"); if (poglavje == "page-index") { $("#mCSB_1_container ul").eq(0).find("li:first a").addClass("mobile-active"); } else if (poglavje == "page-poglavje2") { $("#mCSB_1_container ul").eq(1).find("li:first a").addClass("mobile-active"); } else if (poglavje == "page-poglavje3") { $("#mCSB_1_container ul").eq(2).find("li:first a").addClass("mobile-active"); } else if (poglavje == "page-poglavje4") { $("#mCSB_1_container ul").eq(3).find("li:first a").addClass("mobile-active"); } }); animateCircles(); $(window).scroll(function () { var scrol_position_bottom = $(this).scrollTop() + $(this).height(); var scrol_position_bottom2 = $(this).scrollTop() + $(this).height() - 500; if ($(".seizmograf-line").length && $(window).width() > 920) { var seizmograf_top = $(".seizmograf-line").offset().top; $("[data-shake]").each(function () { var seizmograf_child_top = seizmograf_top + parseInt($(this).css('top')); if (seizmograf_child_top <= scrol_position_bottom2) { $(this).show(); if ($(this).attr("data-shake") == 'left' && !$(this).hasClass('showed')) { $(this).addClass("showed"); $(this).stop(true, false).animate({ left: 0, opacity: 1 }, 1000, "swing", function () { }); } else if ($(this).attr("data-shake") == 'right' && !$(this).hasClass('showed')) { $(this).addClass("showed"); $(this).stop(true, false).animate({ right: 0, opacity: 1 }, 1000, "swing", function () { }); } } else if (seizmograf_child_top + 450 > scrol_position_bottom) { if ($(this).attr("data-shake") == 'left' && $(this).hasClass('showed')) { $(this).removeClass("showed"); $(this).stop(true, false).animate({ left: "-100%", opacity: 0 }, 1000, "swing", function () { $(this).hide(); }); } else if ($(this).attr("data-shake") == 'right' && $(this).hasClass('showed')) { $(this).removeClass("showed"); $(this).stop(true, false).animate({ right: "-100%", opacity: 0 }, 1000, "swing", function () { $(this).hide(); }); } } }); } //shandlej slide blockqoute $("[data-slidein]").each(function () { if ($(this).hasClass("slidein")) { if ($(this).offset().top <= scrol_position_bottom) $(this).removeClass("slidein"); } else { if ($(this).offset().top > scrol_position_bottom) $(this).addClass("slidein"); } }); //Section fadein effect $("[data-fadein]").each(function () { if ($(this).hasClass("fadein")) { if ($(this).offset().top <= scrol_position_bottom) $(this).removeClass("fadein"); } else { if ($(this).offset().top > scrol_position_bottom) $(this).addClass("fadein"); } }); }); }); function animateCircles() { if ($(window).width() > 920 && $('.with-counter-wrap.no-padding.full-width').length) { $('.with-counter-wrap.no-padding.full-width').css('background-size', '20%'); $('.with-counter-wrap.no-padding.full-width').animate({ backgroundSize: '90%' }, 1500, animateCircles); } } /** * Created by Slaven-PM on 6. 09. 2016. */ $(document).ready(function () { $('#collapse-insurance ul li').each(function(){ $(this).click(function () { $("#collapse-insurance ul li p").collapse('hide'); }); }); }); /****** cookies ********/ function setCookie(c_name,value,exdays) { var exdate=new Date(); exdate.setDate(exdate.getDate() + exdays); var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()); document.cookie=c_name + "=" + c_value+"; path=/"; } function eraseCookieFromAllPaths(name) { // This function will attempt to remove a cookie from all paths. var pathBits = location.pathname.split('/'); var pathCurrent = ' path='; // do a simple pathless delete first. document.cookie = name + '=; expires=Thu, 01-Jan-70 00:00:01 GMT;'; for (var i = 0; i < pathBits.length; i++) { pathCurrent += ((pathCurrent.substr(-1) != '/') ? '/' : '') + pathBits[i]; document.cookie = name + '=; expires=Thu, 01-Jan-70 00:00:01 GMT;' + pathCurrent + ';'; } } function getCookie(c_name) { var c_value = document.cookie; var c_start = c_value.indexOf(" " + c_name + "="); if (c_start == -1) { c_start = c_value.indexOf(c_name + "="); } if (c_start == -1) { c_value = null; } else { c_start = c_value.indexOf("=", c_start) + 1; var c_end = c_value.indexOf(";", c_start); if (c_end == -1) { c_end = c_value.length; } c_value = unescape(c_value.substring(c_start,c_end)); } return c_value; } $(document).ready(function () { $.ajax({ type: 'GET', url: '//eos.triglav.si/webapp/svetovalnica/eartquakes.php', contentType: "jsonp", dataType: 'jsonp', success: function (json) { /* call back */ $('#get-eq-count').text(json); } }); }); $(function() { FastClick.attach(document.body); }); $(document).ready(function () { //Placeholder fallback if (!("placeholder" in document.createElement("input"))) { $("input[placeholder], textarea[placeholder]").each(function () { var val = $(this).attr("placeholder"); if (this.value == "") { this.value = val; } $(this).focus(function () { if (this.value == val) { this.value = ""; } }).blur(function () { if ($.trim(this.value) == "") { this.value = val; } }) }); // Clear default placeholder values on form submit $('form').submit(function () { $(this).find("input[placeholder], textarea[placeholder]").each(function () { if (this.value == $(this).attr("placeholder")) { this.value = ""; } }); }); } }); $(document).ready(function () { //animateTheBox(); $(window).resize(function () { animateTheBox(); }); $('.close-intenziteta').on('click', function () { // $('#kako-mocno-nas-lahko-strese').removeClass('intenziteta-viii intenziteta-vii intenziteta-vi opened-int'); clearAll(); $('#circles-overlay').removeClass('intenziteta-viii intenziteta-vii intenziteta-vi opened-int running-circles').hide(); }); $('#intenziteta > g').each(function () { var circles = $('#circles-overlay'); var mainParrent = $('#kako-mocno-nas-lahko-strese'); var openedClass = ''; $(this).on('click', function () { openedClass = $(this).attr('id'); // mainParrent.removeClass('intenziteta-viii intenziteta-vii intenziteta-vi opened-int'); clearAll(); mainParrent.addClass(openedClass + ' opened-int'); if ($(window).width() > 920) { circles.removeClass('intenziteta-viii intenziteta-vii intenziteta-vi opened-int'); centeringCircle(mainParrent, circles, $(this)); circles.addClass(openedClass + ' running-circles'); } }); $(this).mouseenter(function () { if (!(circles.hasClass('intenziteta-viii') || circles.hasClass('intenziteta-vii') || circles.hasClass('intenziteta-vi')) && $(window).width() > 920) { circles.addClass('running-circles'); centeringCircle(mainParrent, circles, $(this)); } }).mouseleave(function () { if (!(circles.hasClass('intenziteta-viii') || circles.hasClass('intenziteta-vii') || circles.hasClass('intenziteta-vi')) && $(window).width() > 920) { circles.removeClass('running-circles'); circles.hide(); } }); }); $('.intenziteta-arrow').each(function () { $(this).on('click', function () { var theClass = $('#kako-mocno-nas-lahko-strese').attr("class").match(/intenziteta[\w-]*\b/); // console.log(theClass[0]); if($(this).hasClass('nav-prev')){ if(theClass[0] != 'intenziteta-vi'){ clearAll(); $('#kako-mocno-nas-lahko-strese').addClass(theClass[0].slice(0,-1) + ' opened-int'); } else { clearAll(); $('#kako-mocno-nas-lahko-strese').addClass('intenziteta-viii opened-int'); } } else { if(theClass[0] != 'intenziteta-viii'){ clearAll(); $('#kako-mocno-nas-lahko-strese').addClass(theClass[0] + 'i opened-int'); } else { clearAll(); $('#kako-mocno-nas-lahko-strese').addClass('intenziteta-vi opened-int'); } } }); }); }); function clearAll() { $('#kako-mocno-nas-lahko-strese').removeClass('intenziteta-viii intenziteta-vii intenziteta-vi opened-int'); } function centeringCircle(mainParrent, circles, that) { var parrentOffset = mainParrent.offset(); var $this = that.find('.center'); var offset = $this.offset(); var width = $this.width(); var height = $this.height(); var centerX = offset.left + width / 2 - parrentOffset.left; var centerY = offset.top + height / 2 - parrentOffset.top; animateTheBox(); circles.show(); if ($(window).width() < 1024) { circles.css({ top: centerY - (875 / 2), left: centerX - (875 / 2) }); } else { circles.css({ top: centerY - (875 / 2), left: centerX - (875 / 2) }); } } function animateTheBox() { if ($(window).width() > 920 && $('#circles-overlay').hasClass('running-circles')) { $('#circles-overlay').css('background-size', '20%'); $('#circles-overlay').animate({ backgroundSize: '90%' }, 1500, animateTheBox); } } $(document).ready(function () { mainMenu(); menuHeightFix(); $(window).resize(function () { $('body').removeClass('noscroll'); menuHeightFix(); }); }); function mainMenu() { $(".openmenu").each(function () { $(this).on('click', function () { if ($('.head-menu-wrap, #nav-icon').hasClass('open')) { $('.head-menu-wrap, #nav-icon').stop(true, true).removeClass('open', 500, 'linear'); if ($(window).width() < 920) { $('body').removeClass('noscroll'); } } else { $('.head-menu-wrap, #nav-icon').stop(true, true).addClass('open', 500, 'linear'); if ($(window).width() < 920) { $('body').addClass('noscroll'); $('.head-menu-wrap nav ul li a').on('click', function (){ $('.head-menu-wrap, #nav-icon').stop(true, true).removeClass('open', 500, 'linear'); $('body').removeClass('noscroll'); }); } } }); }) } function menuHeightFix() { if ($(window).width() > 920) { var docHeight = $(window).height() - 100; $('.head-main-menu').css('height', docHeight + 'px'); } else if ($(window).width() < 920 && $(window).width() > 645) { var docHeight = $(window).height() - 150; $('.head-main-menu').css('height', docHeight + 'px'); } else { var docHeight = $(window).height() - 120; $('.head-main-menu').css('height', docHeight + 'px'); } //else { // var docHeight = $(window).height() - 200; // $('.head-main-menu').css('height', docHeight + 'px'); //} } $(document).ready(function () { $(window).scroll(function () { if ($(window).width() > 645) { //On top gumb if ($(this).scrollTop() > 300) { $('div.ontop').fadeIn(); } else { $('div.ontop').fadeOut(); } } }); $("div.ontop").click(function () { $("html, body").animate({scrollTop: 0}, "slow"); return false; }); }); $(document).ready(function () { $(".head-main-menu").mCustomScrollbar({ axis:"y", theme: "minimal-dark", autoExpandScrollbar: true }); }); $(document).ready(function () { //console.log(window.location.hash); //$("html, body").animate({scrollTop: 0}); $( window ).load(function() { if (window.location.hash != ''){ $("html, body").stop(true,false).animate({ scrollTop: $(window.location.hash).offset().top }, 1000); } else { $("html, body").animate({scrollTop: 0}); } //console.log(window.location.hash); //window.location.hash=''; }); //console.log(window.location.hash); $(function() { $('a[href*="#"]:not([href="#"]):not([data-toggle="tab"])').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) { $('html, body').stop(true,false).animate({ scrollTop: target.offset().top - 50 }, 1000); return false; } } }); }); }); $(document).ready(function () { $(window).scroll(function () { $('#casovni-pregled-potresov .seizmograf-line').each(function () { var offset_seizmograf = $(this).offset().top - $(window).height(); var scroll_curr_position = $(window).scrollTop(); var seizmograf_height = scroll_curr_position - offset_seizmograf; var seizmograf_bg_height = $(window).scrollTop() - $('#casovni-pregled-potresov').offset().top + $(window).height(); if (seizmograf_height > 10) { if ($(window).width() > 920) { //$('#casovni-pregled-potresov').css('height', seizmograf_bg_height + 'px'); $(this).stop().animate({ height: seizmograf_height - 200 + "px" }, 3500, "easeOutCirc"); } } if ($(window).width() > 920) { var over_or_under_bg = scroll_curr_position - offset_seizmograf - $(this).height(); if (over_or_under_bg < 0) { $(this).css('height', seizmograf_height + "px") } } }); }); if ($(window).width() < 920) { var parrent_seizmograf = $('#casovni-pregled-potresov'); var current_button_position = 0; $('.load-all-seizmograf').on('click', function () { if (parrent_seizmograf.hasClass('show-all')) { if ($(window).width() < 450 && $(window).width() > 375) { parrent_seizmograf.css('height', '3900px').removeClass('show-all'); } else if ($(window).width() < 376 && $(window).width() > 320) { parrent_seizmograf.css('height', '3900px').removeClass('show-all'); } else if ($(window).width() < 321) { parrent_seizmograf.css('height', '3850px').removeClass('show-all'); } else { parrent_seizmograf.css('height', '4800px').removeClass('show-all'); } $(this).text('NALOĊ½I VSE POTRESE'); //$(document).scrollTop(current_button_position, 'slow'); //$(document).animate({ scrollTop: current_button_position+"px" }); $("body").animate({ scrollTop: current_button_position }, "slow"); } else { current_button_position = $(this).offset().top - 100; if ($(window).width() < 645 && $(window).width() > 450) { parrent_seizmograf.css('height', '13250px').addClass('show-all'); } else if($(window).width() < 450 && $(window).width() > 375) { parrent_seizmograf.css('height', '10250px').addClass('show-all'); } else if($(window).width() < 376 && $(window).width() > 320) { parrent_seizmograf.css('height', '10250px').addClass('show-all'); } else if($(window).width() < 321) { parrent_seizmograf.css('height', '10150px').addClass('show-all'); } else { parrent_seizmograf.css('height', '13266px').addClass('show-all'); } $(this).text('SKRIJ VSE POTRESE'); } }); } }); /** * Start of CUSTOM SOCIAL LINKS */ var pathname; var product_name; var description; var share_image; var share_capt; var share_url; var twitter_capt; $(document).ready(function () { $('section .body-share ul li a.social_twitter_square').each(function () { getIdData($(this).attr("href")); var encoded = encodeURIComponent(twitter_capt); $(this).attr("href", "https://twitter.com/intent/tweet?text=" + encoded + "&url=" + encodeURIComponent(share_url)); }); $('section .body-share ul li a.icon_mail').each(function () { getIdData($(this).attr("href")); $(this).attr("href", "mailto:?subject=" + product_name + "&body=" + description + " - " + share_url); }); $('section .body-share ul li a.social_linkedin').each(function () { getIdData($(this).attr("href")); var encoded = encodeURIComponent(product_name); var encoded2 = encodeURIComponent(description); var encoded3 = encodeURIComponent(share_url); $(this).attr("href", "http://www.linkedin.com/shareArticle?mini=true&url=" + encoded3 + "&title=" + encoded + "&summary=" + encoded2 + "&source=" + pathname + window.location.pathname); }); $(window).load(function () { $('section .body-share ul li a.social_facebook_square').each(function () { $(this).on('click', function () { FBShareOp($(this).attr("href")); }); }); }); function FBShareOp(getId) { getIdData(getId); FB.ui({ method: 'feed', display: 'popup', name: product_name, link: share_url, picture: share_image, caption: share_capt, description: description }, function (response) { //console.log(response); //if(response && response.post_id){} //else{} }); } }); // Function for getting data from class for-sharing function getIdData(getId) { pathname = window.location.protocol + '//' + window.location.host; product_name = $(getId + " h2:first").text(); description = $(getId + " .for-sharing .share_description").text(); share_image = pathname + '/img' + $(getId + " .for-sharing .share_image").text(); share_capt = $(getId + " .for-sharing .share_caption").text(); //twitter_capt = $(getId + " .for-sharing .twitter_caption").text(); twitter_capt = product_name; share_url = pathname + window.location.pathname + getId; } // Function for popup linkedin $(function ($) { $.fn.customerPopup = function (e, intWidth, intHeight, blnResize) { // Prevent default anchor event e.preventDefault(); // Set values for window intWidth = intWidth || '500'; intHeight = intHeight || '400'; strResize = (blnResize ? 'yes' : 'no'); // Set title and open popup with focus on it var strTitle = ((typeof this.attr('title') !== 'undefined') ? this.attr('title') : 'Social Share'), strParam = 'width=' + intWidth + ',height=' + intHeight + ',resizable=' + strResize, objWindow = window.open(this.attr('href'), strTitle, strParam).focus(); }; /* ================================================== */ $(document).ready(function ($) { $('section .body-share ul li a.social_linkedin').on("click", function (e) { $(this).customerPopup(e); }); }); }(jQuery)); /** * End of CUSTOM SOCIAL LINKS */ $(document).ready(function () { $('.head-menu-wrap nav.head-main-menu ul li a').each(function(){ $(this).on('click', function(){ var that = $(this).attr('href'); //console.log(that); switch (that){ case 'poglavje03.html#doma-delu': $('.tabbed-gallery-wrap ul li.active').removeClass('active'); $('.tabbed-gallery-wrap ul li a[aria-controls="doma-delu"]').parent().addClass('active'); special_gallery.slick('slickGoTo', 0); break; case 'poglavje03.html#prostem-javnih-prostorih': $('.tabbed-gallery-wrap ul li.active').removeClass('active'); $('.tabbed-gallery-wrap ul li a[aria-controls="prostem-javnih-prostorih"]').parent().addClass('active'); special_gallery.slick('slickGoTo', 6); break; case 'poglavje03.html#avtomobilu': $('.tabbed-gallery-wrap ul li.active').removeClass('active'); $('.tabbed-gallery-wrap ul li a[aria-controls="avtomobilu"]').parent().addClass('active'); special_gallery.slick('slickGoTo', 11); break; } }); }); $('.slick-slideshow').each(function () { $(this).slick({ slidesToShow: 1, slidesToScroll: 1, //asNavFor: '.slick-buttons', dots: false, adaptiveHeight: false, //variableWidth: true, fade: true, arrows: true, infinite: false, cssEase: 'linear', prevArrow: '', nextArrow: '', //appendArrows: '.slideshow-nav' onAfterChange: function (slide, index) { //console.log($(this).attr('id')); //console.log($(slide).attr('id')); } }) }); $('.tabbed-slideshow-slick').slick('slickSetOption', 'speed', 220, false); $('.tabbed-slideshow-slick').slick('slickSetOption', 'adaptiveHeight', false, false); var special_gallery = $('#tabbed-slick-gallery'); // On before slide change special_gallery.on('beforeChange', function (event, slick, currentSlide, nextSlide) { //console.log(nextSlide); switch (true) { case (nextSlide < 6): $('.tabbed-gallery-wrap ul li.active').removeClass('active'); $('.tabbed-gallery-wrap ul li a[aria-controls="doma-delu"]').parent().addClass('active'); $('.tabbed-gallery-wrap .nav-tabs').slick('slickGoTo', 0); break; case (nextSlide >= 6 && nextSlide < 11): $('.tabbed-gallery-wrap ul li.active').removeClass('active'); $('.tabbed-gallery-wrap ul li a[aria-controls="prostem-javnih-prostorih"]').parent().addClass('active'); $('.tabbed-gallery-wrap .nav-tabs').slick('slickGoTo', 1); break; case (nextSlide >= 11): $('.tabbed-gallery-wrap ul li.active').removeClass('active'); $('.tabbed-gallery-wrap ul li a[aria-controls="avtomobilu"]').parent().addClass('active'); $('.tabbed-gallery-wrap .nav-tabs').slick('slickGoTo', 2); break; } }); $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { //e.target // newly activated tab //e.relatedTarget // previous active tab switch ($(this).attr('href')) { case '#doma-delu': special_gallery.slick('slickGoTo', 0); break; case '#prostem-javnih-prostorih': special_gallery.slick('slickGoTo', 6); break; case '#avtomobilu': special_gallery.slick('slickGoTo', 11); break; } }); //Animation slick if ($(".tabbed-gallery-wrap").length) { $('.tabbed-gallery-wrap .nav-tabs').slick({ slidesToShow: 3, slidesToScroll: 1, //asNavFor: '.slick-flood', dots: false, //adaptiveHeight: true, //variableWidth: true, arrows: true, infinite: false, prevArrow: '', nextArrow: '', //appendArrows: '.features-nav', responsive: [ { breakpoint: 920, settings: { slidesToShow: 1, slidesToScroll: 1 } } ] }).on('beforeChange', function (event, slick, currentSlide, nextSlide) { //console.log(nextSlide); switch (nextSlide) { case 0: $('.tabbed-gallery-wrap ul li.active').removeClass('active'); $('.tabbed-gallery-wrap ul li a[aria-controls="doma-delu"]').parent().addClass('active'); special_gallery.slick('slickGoTo', 0); break; case 1: $('.tabbed-gallery-wrap ul li.active').removeClass('active'); $('.tabbed-gallery-wrap ul li a[aria-controls="prostem-javnih-prostorih"]').parent().addClass('active'); special_gallery.slick('slickGoTo', 6); break; case 2: $('.tabbed-gallery-wrap ul li.active').removeClass('active'); $('.tabbed-gallery-wrap ul li a[aria-controls="avtomobilu"]').parent().addClass('active'); special_gallery.slick('slickGoTo', 11); break; } }); } }); $(document).ready(function () { var tooltipDef = $('[data-toggle="tooltip"]'); if(tooltipDef.length){ tooltipDef.tooltip(); $("body").on("click touchstart", '[data-toggle="tooltip"]', function() { $(this).tooltip("show"); tooltipDef.not(this).tooltip("hide"); // hide other tooltips return false; }); $("body").on("click touchstart", function() { tooltipDef.tooltip("hide"); // hide all tooltips when clicked on body }); } });