'use strict'; var theme = function () { // prevent empty links // --------------------------------------------------------------------------------------- function handlepreventemptylinks() { $('a[href=#]').click(function (event) { event.preventdefault(); }); } // placeholdem // --------------------------------------------------------------------------------------- /*function handleplaceholdem() { placeholdem(document.queryselectorall('[placeholder]')); }*/ // bootstrapselect // --------------------------------------------------------------------------------------- /*function handlebootstrapselect() { $('.selectpicker').selectpicker(); }*/ // add hover class for correct view on mobile devices // --------------------------------------------------------------------------------------- function handlehoverclass() { var hover = $('.thumbnail'); hover.hover( function () { $(this).addclass('hover'); }, function () { $(this).removeclass('hover'); } ); } // superfish menu // --------------------------------------------------------------------------------------- function handlesuperfish() { $('ul.sf-menu').superfish(); $('ul.sf-menu a').click(function () { $('body').scrollspy('refresh'); }); // fixed menu toggle $('.menu-toggle').on('click', function () { if ($('.navigation').hasclass('opened')) { $(this).find('.fa').removeclass('fa-times').addclass('fa-bars'); $('.navigation').removeclass('opened').addclass('closed'); } else { $(this).find('.fa').removeclass('fa-bars').addclass('fa-times'); $('.navigation').removeclass('closed').addclass('opened'); } }); // submenu fix $('.mobile-submenu').click(function () { $(this).parent().toggleclass('mobile-submenu-open'); }); $('ul.sf-menu a').click(function () { $('ul.sf-menu li').removeclass('mobile-submenu-open'); }); } // smooth scrolling // --------------------------------------------------------------------------------------- function handlesmoothscroll() { $('.sf-menu a, .scroll-to').click(function () { if ($(this).hasclass('btn-search-toggle')) { $('.header-search-wrapper').fadetoggle(); $('.header').toggleclass('header-overlay'); } else { //var headerh = $('header').outerheight(); var headerh = 0; $('.sf-menu a').removeclass('active'); $(this).addclass('active'); $('html, body').animate({ scrolltop: $($(this).attr('href')).offset().top - headerh + 'px' }, { duration: 1200, easing: 'easeinoutexpo' }); return false; } }); } // prettyphoto // --------------------------------------------------------------------------------------- function handleprettyphoto() { $("a[data-gal^='prettyphoto']").prettyphoto({ theme: 'dark_square' }); } // scroll totop button // --------------------------------------------------------------------------------------- function handletotopbutton() { $(window).scroll(function () { if ($(this).scrolltop() > 1) { $('.to-top').css({bottom: '15px'}); } else { $('.to-top').css({bottom: '-100px'}); } }); $('.to-top').click(function () { $('html, body').animate({scrolltop: '0px'}, 800); return false; }); } // preloader // --------------------------------------------------------------------------------------- $(window).load(function () { $('#status').fadeout(); $('#preloader').delay(200).fadeout(100); }); // isotope $(window).load(function () { /*if ($().isotope) { $('.isotope').isotope({ // initialize isotope itemselector: '.isotope-item' // options... //,transitionduration: 0 // disable transition }); $('#filtrable a').click(function () { // filter items when filter link is clicked var selector = $(this).attr('data-filter'); $('#filtrable a').parent().removeclass('current'); $(this).parent().addclass('current'); $('.isotope').isotope({filter: selector}); return false; }); $('.isotope').isotope('relayout'); // layout/relayout }*/ if ($().isotope) { $('.isotope.events').isotope({// initialize isotope filter: '.festival', itemselector: '.isotope-item' // options... //,transitionduration: 0 // disable transition }); $('#filtrable-events a').click(function () { // filter items when filter link is clicked var selector = $(this).attr('data-filter'); $('#filtrable-events a').parent().removeclass('current'); $(this).parent().addclass('current'); $('.isotope.events').isotope({filter: selector}); $('.isotope').isotope('relayout', $.waypoints('refresh')); // layout/relayout return false; }); } if ($().isotope) { $('.isotope.gallery').isotope({// initialize isotope itemselector: '.isotope-item' // options... //,transitionduration: 0 // disable transition }); $('#filtrable-gallery a').click(function () { // filter items when filter link is clicked var selector = $(this).attr('data-filter'); $('#filtrable-gallery a').parent().removeclass('current'); $(this).parent().addclass('current'); $('.isotope.gallery').isotope({filter: selector}); $('.isotope').isotope('relayout', $.waypoints('refresh')); // layout/relayout return false; }); } }); $(window).resize(function () { // refresh isotope if ($().isotope) { $('.isotope').isotope('relayout', $.waypoints('refresh')); // layout/relayout on window resize } }); // shrink header on scroll // --------------------------------------------------------------------------------------- function handleanimatedheader() { var header = $('.header.fixed'); function refresh() { var scroll = $(window).scrolltop(); if (scroll >= 99) { header.addclass('shrink'); } else { header.removeclass('shrink'); } $.waypoints('refresh'); } ; $(window).load(function () { refresh(); }); $(window).scroll(function () { refresh(); }); $(window).on('touchstart', function () { refresh(); }); $(window).on('scrollstart', function () { refresh(); }); $(window).on('scrollstop', function () { refresh(); }); $(window).on('touchmove', function () { refresh(); }); } // handletabsfaq // --------------------------------------------------------------------------------------- function handletabsfaq() { if ($('#tabs-faq').length) { var tabs = $('#tabs-faq'); tabs.find('a').on('click', function () { tabs.find('.fa-angle-right').removeclass('fa-angle-right').addclass('fa-plus'); $(this).find('.fa').removeclass('fa-plus').addclass('fa-angle-right'); }); } } // resize page // --------------------------------------------------------------------------------------- function resizepage() { if ($('body').hasclass('boxed')) { $('#main-slider').find('.page').each(function () { $(this).removeattr('style'); }); } // if ($('body').hasclass('coming-soon')) { // $('#main-slider').find('.page').each(function () { // $(this).removeattr('style'); // $('.page').css('min-height', $(window).height()); // }); // } // else { // $('.page').css('min-height', $(window).height()); // } $('#main-slider').trigger('refresh'); $('#testimonials').trigger('refresh'); $('.partners-carousel .owl-carousel').trigger('refresh'); $('.partners-carousel-2 .owl-carousel').trigger('refresh'); $('.carousel-slider .owl-carousel').trigger('refresh'); } // init functions // --------------------------------------------------------------------------------------- return { onresize: function () { resizepage(); }, init: function () { handlepreventemptylinks(); //handleplaceholdem(); //handlebootstrapselect(); handlehoverclass(); handlesuperfish(); //handlesmoothscroll(); //去掉之后点击顶部菜单就不报错了 tobibear handleprettyphoto(); handletotopbutton(); //handleanimatedheader(); handletabsfaq(); }, // main slider initmainslider: function () { $('#main-slider').owlcarousel({ //items: 1, autoplay: true, autoplayhoverpause: true, loop: true, margin: 0, dots: false, nav: true, navtext: [ "", "" ], responsiverefreshrate: 100, responsive: { 0: {items: 1}, 479: {items: 1}, 768: {items: 1}, 991: {items: 1}, 1024: {items: 1} } }); }, // countdown /*initcountdown: function () { var austday = new date(); austday = new date(austday.getfullyear() + 1, 1 - 1, 26); $('#defaultcountdown').countdown({until: austday}); $('#defaultcountdown2').countdown({until: austday}); },*/ // images carousel initimagecarousel: function () { $('.img-carousel').owlcarousel({ autoplay: false, loop: true, margin: 0, dots: true, nav: true, navtext: [ "", "" ], responsiverefreshrate: 100, responsive: { 0: {items: 1}, 479: {items: 1}, 768: {items: 1}, 991: {items: 1}, 1024: {items: 1} } }); }, initcorouselslider4: function () { $('.carousel-slider .owl-carousel.slide-4').owlcarousel({ autoplay: true, loop: true, margin: 30, dots: false, nav: true, navtext: [ "", "" ], responsive: { 0: {items: 1}, 480: {items: 2}, 767: {items: 3}, 991: {items: 3}, 1024: {items: 4} } }); }, initcorouselslider3: function () { $('.carousel-slider .owl-carousel.slide-3').owlcarousel({ autoplay: false, loop: true, margin: 30, dots: false, nav: true, navtext: [ "", "" ], responsive: { 0: {items: 1}, 480: {items: 2}, 767: {items: 3}, 991: {items: 3}, 1024: {items: 4} } }); }, // partners slider initpartnerslider: function () { $('.partners-carousel .owl-carousel').owlcarousel({ autoplay: false, loop: true, margin: 25, dots: false, nav: true, navtext: [ "", "" ], responsive: { 0: {items: 1}, 370: {items: 2}, 768: {items: 3}, 991: {items: 5}, 1024: {items: 6} } }); }, // partners slider initpartnerslider2: function () { $('.partners-carousel-2 .owl-carousel').owlcarousel({ autoplay: true, loop: true, margin: 25, dots: false, nav: true, navtext: [ "", "" ], responsive: { 0: {items: 1}, 479: {items: 2}, 768: {items: 3}, 991: {items: 5}, 1024: {items: 5} } }); }, // partners slider initeventcarousel: function () { $('.event-carousel .owl-carousel').owlcarousel({ autoplay: false, loop: false, margin: 25, dots: true, nav: true, navtext: [ "", "" ], responsive: { 0: {items: 1}, 479: {items: 1}, 768: {items: 2}, 991: {items: 3}, 1024: {items: 4} } }); }, // main slider // testimonials inittestimonials: function () { $('#testimonials').owlcarousel({ items: 1, autoplay: false, loop: true, dots: true, nav: false, navtext: [ "", "" ] }); }, // animation on scroll initanimation: function () { var ismobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.useragent); if (ismobile == false) { $('*[data-animation]').addclass('animated'); $('.animated').waypoint(function (down) { var elem = $(this); var animation = elem.data('animation'); if (!elem.hasclass('visible')) { var animationdelay = elem.data('animation-delay'); if (animationdelay) { settimeout(function () { elem.addclass(animation + ' visible'); }, animationdelay); } else { elem.addclass(animation + ' visible'); } } }, { offset: $.waypoints('viewportheight') //offset: 'bottom-in-view' //offset: '95%' }); } // refresh waypoints on tab click / animation $('#tabs-lv1 li a[data-toggle="tab"]').on('shown.bs.tab', function () { $.waypoints('refresh'); }); $('#tabs-lv2 li a[data-toggle="tab"]').on('shown.bs.tab', function () { $.waypoints('refresh'); }); }, // google map /*initgooglemap: function () { var map; var marker; var image = 'assets/img/icon-google-map.png'; // marker icon function initialize() { var mapoptions = { scrollwheel: false, zoom: 10, center: new google.maps.latlng(40.9807648, 28.9866516) // map coordinates }; map = new google.maps.map(document.getelementbyid('map-canvas'), mapoptions); marker = new google.maps.marker({ position: new google.maps.latlng(41.0096559, 28.9755535), // marker coordinates map: map, icon: image, title: 'hello world!' }); } google.maps.event.adddomlistener(window, 'load', initialize); }*/ }; }(); $(document).ready(function () { // google map // --------------------------------------------------------------------------------------- /*if (typeof google === 'object' && typeof google.maps === 'object') { if ($('#map-canvas1').length) { var map; var marker, marker2, marker3, marker4, marker5, marker6,marker7, marker8; var infowindow; var image = 'assets/img/icon-google-map.png'; // marker icon google.maps.event.adddomlistener(window, 'load', function () { var mapoptions = { scrollwheel: false, zoom: 10, center: new google.maps.latlng(41.079379,28.9984466) // map coordinates }; map = new google.maps.map(document.getelementbyid('map-canvas1'), mapoptions); marker = new google.maps.marker({ position: new google.maps.latlng(41.0096559,28.9755535), // marker coordinates map: map, icon: image, title: 'hello world!' }); marker2 = new google.maps.marker({ position: new google.maps.latlng(41.007135, 28.910556), // marker coordinates map: map, icon: image, title: 'hello world!' }); marker3 = new google.maps.marker({ position: new google.maps.latlng(41.040807, 28.848071), // marker coordinates map: map, icon: image, title: 'hello world!' }); marker4 = new google.maps.marker({ position: new google.maps.latlng(41.051164, 29.078097), // marker coordinates map: map, icon: image, title: 'hello world!' }); marker5 = new google.maps.marker({ position: new google.maps.latlng(41.077050, 28.995013), // marker coordinates map: map, icon: image, title: 'hello world!' }); infowindow = new google.maps.infowindow({ content: contentstring ,maxwidth: 50 //,maxheight: 500 }); google.maps.event.addlistener(marker, 'click', function() { infowindow.open(map,marker); }); // more markers google.maps.event.addlistener(marker2, 'click', function() { infowindow.open(map,marker2); }); google.maps.event.addlistener(marker3, 'click', function() { infowindow.open(map,marker3); }); google.maps.event.addlistener(marker4, 'click', function() { infowindow.open(map,marker4); }); google.maps.event.addlistener(marker5, 'click', function() { infowindow.open(map,marker5); }); // open marker when google map init function initialize() { google.maps.event.trigger(marker, 'click'); } initialize(); /1* * the google.maps.event.addlistener() event waits for * the creation of the infowindow html structure 'domready' * and before the opening of the infowindow defined styles * are applied. *1/ google.maps.event.addlistener(infowindow, 'domready', function() { // reference to the div which receives the contents of the infowindow using jquery var iwouter = $('.gm-style-iw'); /1* the div we want to change is above the .gm-style-iw div. * so, we use jquery and create a iwbackground variable, * and took advantage of the existing reference to .gm-style-iw for the previous div with .prev(). *1/ var iwbackground = iwouter.prev(); // remove the background shadow div iwbackground.children(':nth-child(2)').css({'display' : 'none'}); // remove the white background div iwbackground.children(':nth-child(4)').css({'display' : 'none'}); // moves the infowindow 115px to the right. iwouter.parent().parent().css({left: '10px'}); // moves the shadow arrow // hide iwbackground.children(':nth-child(1)').attr('style', function(i,s){ return s + 'display: none !important;'}); // moves the arrow 76px to the left margin iwbackground.children(':nth-child(3)').attr('style', function(i,s){ return s + 'left: 80px !important; margin-top: -10px; z-index: 0;'}); // changes the desired color for the tail outline. // the outline of the tail is composed of two descendants of div which contains the tail. // the .find('div').children() method refers to all the div which are direct descendants of the previous div. iwbackground.children(':nth-child(3)').find('div').children().css({'box-shadow': 'rgba(255, 255, 255, 0.1) 0px 1px 6px', 'z-index' : '1'}); // taking advantage of the already established reference to // div .gm-style-iw with iwouter variable. // you must set a new variable iwclosebtn. // using the .next() method of jquery you reference the following div to .gm-style-iw. // is this div that groups the close button elements. var iwclosebtn = iwouter.next(); // apply the desired effect to the close button iwclosebtn.css({ opacity: '1', right: '48px', top: '14px', width: '19px', height: '19px', border: '3px solid #ffffff', 'border-radius': '17px', 'background-color': '#ffffff' }); // the api automatically applies 0.7 opacity to the button after the mouseout event. // this function reverses this event to the desired value. iwclosebtn.mouseout(function(){ $(this).css({opacity: '1'}); }); }); // }); } }*/ });