1/*! 2 * Template Functions 3*/ 4 5(function($){ 6 7 "use strict"; 8 9 /* ---------------------------------------------- /* 10 * Preloader 11 /* ---------------------------------------------- */ 12 13 $(window).on('load', function() { 14 15 if($('div').is('.page-loader')) { 16 $('.page-loader').delay(500).fadeOut(800); 17 } 18 19 }); 20 21 $(document).ready(function() { 22 23 var header = $('.header'), 24 one_page_nav = $('.onepage-nav'), 25 parallax = $('.parallax'), 26 bloggrid = $('.row-post-masonry'), 27 background = $('[data-background]'), 28 module_slides = $('.module-cover-slides'), 29 margin_y = $('[data-mY]'), 30 progress = $('.progress-item'), 31 counter_timer = $('.counter-timer'), 32 pie_chart = $('.chart'), 33 twitter_feed = $('.twitter-feed'), 34 stiky_sidebar = $('.sticky-sidebar'), 35 map = $('.map'), 36 smoothscroll = $('.smoothscroll'), 37 play_btn = $('.play-button'), 38 gallery = $('.gallery'), 39 shop_gallery = $('.shop-single-item-popup'), 40 portfolio_carousel = $('.portfolio-carousel'), 41 shop_carousel = $('.shop-carousel'), 42 clients_carousel = $('.clients-carousel'), 43 review_slides = $('.review-slides'), 44 review_carousel = $('.review-carousel'), 45 image_slider = $('.image-slider'), 46 contact_form = $('#contact-form'); 47 48 /* ---------------------------------------------- /* 49 * Collapse navbar on click 50 /* ---------------------------------------------- */ 51 52 $(document).on('click', '.inner-navigation.show', function(e) { 53 if ($(e.target).is('span') && !$(e.target).parent().parent().hasClass('menu-item-has-children')) { 54 $(this).collapse('hide'); 55 } 56 }); 57 58 /* ---------------------------------------------- /* 59 * One Page Nav 60 /* ---------------------------------------------- */ 61 62 $('a', one_page_nav).filter(function() { 63 if ($(this).is(':not([href^="#"])')) { 64 $(this).addClass('external'); 65 } 66 }); 67 68 one_page_nav.singlePageNav({ 69 filter: ':not(.external)', 70 currentClass: 'active', 71 offset: '58', 72 }); 73 74 /* ---------------------------------------------- /* 75 * Header animation 76 /* ---------------------------------------------- */ 77 78 $(window).scroll(function() { 79 var scroll = $(window).scrollTop(); 80//document.write(scroll); 81 if (scroll < 5) { 82 document.getElementById("nav_header").style.height = 210 + "px"; 83 } 84 if ((scroll >= 1) && (scroll <60)) { 85 header.addClass('begin-scroll'); 86 document.getElementById("nav_header").style.height = ((210 - scroll) + "px"); 87 } else { 88 header.removeClass('begin-scroll'); 89 } 90 if (scroll >= 60) { 91 document.getElementById("nav_header").style.height = 150 + "px"; 92 header.addClass('header-small'); 93 header.addClass('header-shadow'); 94 } else { 95 header.removeClass('header-small'); 96 header.removeClass('header-shadow'); 97 } 98 }).scroll(); 99 100 module_slides.each(function () { 101 $(this).superslides($.extend({ 102 play: 10000, 103 animation: 'slide',
104 animation_speed: 800, 105 pagination: true, 106 scrollable: true, 107 }, $(this).data('module-cover-slides-options'))); 108 }); 109 110 /* ---------------------------------------------- /* 111 * Setting background of modules 112 /* ---------------------------------------------- */ 113 114 parallax.each(function() { 115 if ($(this).attr('data-gradient') == 1) { 116 $(this).append('<div class="overlay-background overlay-gradient"></div>'); 117 $(this).find('.overlay-background').css('opacity', $(this).attr('data-overlay')); 118 } else if ($(this).attr('data-overlay') > 0) { 119 $(this).append('<div class="overlay-background"></div>'); 120 $(this).find('.overlay-background').css('opacity', $(this).attr('data-overlay')); 121 } 122 }); 123 124 background.each(function() { 125 $(this).css('background-image', 'url(' + $(this).attr('data-background') + ')'); 126 }); 127 128 margin_y.each(function() { 129 $(this).css('margin-top', $(this).attr('data-mY') ); 130 }); 131 132 /* ---------------------------------------------- /* 133 * Off-canvas 134 /* ---------------------------------------------- */ 135 136 $('.off-canvas-open, .off-canvas-close').on('click', function() { 137 $('body').toggleClass('off-canvas-sidebar-open'); 138 return false; 139 }).resize(); 140 141 $(document).on('click', function(e) { 142 var container = $('.off-canvas-sidebar'); 143 if (!container.is(e.target) && container.has(e.target).length === 0) { 144 $('body').removeClass('off-canvas-sidebar-open'); 145 } 146 }).resize(); 147 148 function getScrollBarWidth() { 149 var inner = document.createElement('p'); 150 inner.style.width = "100%"; 151 inner.style.height = "200px"; 152 var outer = document.createElement('div'); 153 outer.style.position = "absolute"; 154 outer.style.top = "0px"; 155 outer.style.left = "0px"; 156 outer.style.visibility = "hidden"; 157 outer.style.width = "200px"; 158 outer.style.height = "150px"; 159 outer.style.overflow = "hidden"; 160 outer.appendChild (inner); 161 document.body.appendChild (outer); 162 var w1 = inner.offsetWidth; 163 outer.style.overflow = 'scroll'; 164 var w2 = inner.offsetWidth; 165 if (w1 == w2) w2 = outer.clientWidth; 166 document.body.removeChild (outer); 167 return (w1 - w2); 168 }; 169 170 $('.off-canvas-sidebar-wrapper').css('margin-right', '-' + getScrollBarWidth() + 'px'); 171 172 $(window).on('resize', function() { 173 var width = Math.max($(window).width(), window.innerWidth); 174 175 if ( width <= 991 ) { 176 $('body').removeClass('off-canvas-sidebar-open'); 177 } 178 }); 179 180 /* ---------------------------------------------- /* 181 * Portfolio masonry 182 /* ---------------------------------------------- */ 183 184 var filters = $('.filters'), 185 worksgrid = $('.row-portfolio'); 186 187 $('a', filters).on('click', function() { 188 var selector = $(this).attr('data-filter'); 189 $('.current', filters).removeClass('current'); 190 $(this).addClass('current'); 191 worksgrid.isotope({ 192 filter: selector 193 }); 194 return false; 195 }); 196 197 $(window).on('resize', function() { 198 worksgrid.imagesLoaded(function() { 199 worksgrid.isotope({ 200 layoutMode: 'masonry', 201 itemSelector: '.portfolio-item', 202 transitionDuration: '0.4s', 203 masonry: { 204 columnWidth: '.grid-sizer', 205 }, 206 }); 207 }); 208 }); 209 210 /* ---------------------------------------------- /* 211 * Blog masonry 212 /* ---------------------------------------------- */ 213 214 $(window).on('resize', function() { 215 setTimeout(function() { 216 bloggrid.isotope({ 217 layoutMode: 'masonry', 218 transitionDuration: '0.5s', 219 }); 220 }, 1000); 221 }).resize(); 222 223 /* ---------------------------------------------- /* 224 * Carousel/Sliders 225 /* ---------------------------------------------- */ 226 227 image_slider.each(function () { 228 $(this).owlCarousel($.extend({ 229 dots: 1, 230 nav: 1, 231 center: 1, 232 items: 1, 233 loop: 1, 234 autoHeight: 0, 235 margin: 0, 236 navText: [ 237 '<span class="ti-arrow-left"></span>', 238 '<span class="ti-arrow-right"></span>' 239 ], 240 }, $(this).data('carousel-options'))); 241 }); 242 243 review_slides.each(function () { 244 $(this).owlCarousel($.extend({ 245 autoplay: 5000, 246 nav: 1, 247 items: 1, 248 loop: 1, 249 navText: [ 250 '<span class="ti-arrow-left"></span>', 251 '<span class="ti-arrow-right"></span>' 252 ], 253 }, $(this).data('carousel-options'))); 254 }); 255 256 review_carousel.each(function () { 257 $(this).owlCarousel($.extend({ 258 nav: 0, 259 dots: 1, 260 autoplay: 1, 261 items: 1, 262 loop: 1, 263 margin: 30, 264 responsive: { 265 768: { 266 items: 2 267 }, 268 1025: { 269 items: 3 270 } 271 }, 272 navText: [ 273 '<span class="ti-angle-left"></span>', 274 '<span class="ti-angle-right"></span>' 275 ], 276 }, $(this).data('carousel-options'))); 277 }); 278 279 clients_carousel.each(function () { 280 $(this).owlCarousel($.extend({ 281 nav: 0, 282 dots: 1, 283 autoplay: 1, 284 items: 2, 285 loop: 1, 286 responsive: { 287 768: { 288 items: 4 289 } 290 }, 291 navText: [ 292 '<span class="ti-arrow-left"></span>', 293 '<span class="ti-arrow-right"></span>' 294 ], 295 }, $(this).data('carousel-options'))); 296 }); 297 298 shop_carousel.each(function () { 299 $(this).owlCarousel($.extend({ 300 nav: 0, 301 dots: 1, 302 autoplay: 1, 303 items: 1, 304 loop: 1, 305 margin: 30, 306 responsive: { 307 768: { 308 items: 2 309 }, 310 1025: { 311 items: 4 312 } 313 }, 314 navText: [ 315 '<span class="ti-angle-left"></span>', 316 '<span class="ti-angle-right"></span>' 317 ], 318 }, $(this).data('carousel-options'))); 319 }); 320 321 portfolio_carousel.each(function () { 322 $(this).owlCarousel($.extend({ 323 nav: 1, 324 dots: 0, 325 autoplay: 1, 326 items: 1, 327 loop: 1, 328 margin: 30, 329 responsive: { 330 768: { 331 items: 2 332 }, 333 1025: { 334 items: 4 335 } 336 }, 337 navText: [ 338 '<span class="ti-angle-left"></span>', 339 '<span class="ti-angle-right"></span>' 340 ], 341 }, $(this).data('carousel-options'))); 342 }); 343 344 /* ---------------------------------------------- /* 345 * Popup 346 /* ---------------------------------------------- */ 347 348 play_btn.magnificPopup({ 349 type: 'iframe', 350 }); 351 352 gallery.magnificPopup({ 353 type: 'image', 354 gallery: { 355 enabled: true, 356 navigateByImgClick: true, 357 preload: [0,1] 358 }, 359 image: { 360 titleSrc: 'title', 361 tError: 'The image could not be loaded.', 362 } 363 }); 364 365 shop_gallery.magnificPopup({ 366 type: 'image', 367 gallery: { 368 enabled: true, 369 navigateByImgClick: true, 370 preload: [0,1] 371 }, 372 image: { 373 titleSrc: 'title', 374 tError: 'The image could not be loaded.', 375 } 376 }); 377 378 /* ---------------------------------------------- /* 379 * Progress bars, counters, pie charts animations 380 /* ---------------------------------------------- */ 381 382 progress.each(function() { 383 $(this).appear(function() { 384 var percent = $(this).find('.progress-bar').attr('aria-valuenow'); 385 $(this).find('.progress-bar').animate({'width' : percent + '%'}); 386 $(this).find('.progress-number').countTo({ 387 from: 0, 388 to: percent, 389 speed: 900, 390 refreshInterval: 30 391 }); 392 }); 393 }); 394 395 counter_timer.each(function() { 396 $(this).appear(function() { 397 var number = $(this).find('strong').attr('data-to'); 398 $(this).countTo({ 399 from: 0, 400 to: number, 401 speed: 1500, 402 refreshInterval: 10, 403 formatter: function (number, options) { 404 number = number.toFixed(options.decimals); 405 number = number.replace(/\B(?=(\d{3})+(?!\d))/g, ','); 406 return number; 407 } 408 }); 409 }); 410 }); 411 412 pie_chart.each(function() { 413 $(this).appear(function() { 414 $(this).easyPieChart($.extend({ 415 barColor: '#000000', 416 trackColor: '#eeeeee', 417 scaleColor: false, 418 lineCap: 'round', 419 lineWidth: 3, 420 size: 150, 421 }, $(this).data('chart-options'))); 422 }); 423 }); 424 425 /* ---------------------------------------------- /* 426 * Twitter 427 /* ---------------------------------------------- */ 428 429 twitter_feed.each(function (index) { 430 $(this).attr('id', 'twitter-' + index); 431 var twitterID = $(this).data('twitter'); 432 var twitterMax = $(this).data('number'); 433 var twitter_config = { 434 'id': twitterID, 435 'domId': 'twitter-' + index, 436 'maxTweets': twitterMax, 437 'enableLinks': true, 438 'showPermalinks': false 439 }; 440 twitterFetcher.fetch(twitter_config); 441 }); 442 443 /* ---------------------------------------------- /* 444 * Sticky Sidebar 445 /* ---------------------------------------------- */ 446 447 stiky_sidebar.imagesLoaded(function() { 448 stiky_sidebar.stick_in_parent({ 449 offset_top: 80, 450 recalc_every: 1 451 }) 452 .on('sticky_kit:bottom', function(e) { 453 $(this).parent().css('position', 'relative'); 454 }) 455 .on('sticky_kit:unbottom', function(e) { 456 $(this).parent().css('position', 'relative'); 457 }).scroll(); 458 }); 459 460 /* ---------------------------------------------- /* 461 * Tooltip 462 /* ---------------------------------------------- */ 463 464 $(function () { 465 $('[data-toggle="tooltip"]').tooltip() 466 }) 467 468 /* ---------------------------------------------- /* 469 * A jQuery plugin for fluid width video embeds 470 /* ---------------------------------------------- */ 471 472 $('body').fitVids(); 473 474 /* ---------------------------------------------- /* 475 * Contact form ajax 476 /* ---------------------------------------------- */ 477 478 contact_form.find('input,textarea').jqBootstrapValidation({ 479 preventSubmit: true, 480 submitError: function($form, event, errors) { 481 // additional error messages or events 482 }, 483 submitSuccess: function($form, event) { 484 event.preventDefault(); 485 486 var submit = $('submit', contact_form); 487 var ajaxResponse = $('#contact-response'); 488 var name = $('[name="name"]', contact_form).val(); 489 var email = $('[name="email"]', contact_form).val(); 490 var subject = $('[name="subject"]', contact_form).val(); 491 var message = $('[name="message"]', contact_form).val(); 492 493 $.ajax({ 494 type: 'POST', 495 url: 'assets/php/contact.php', 496 dataType: 'json', 497 data: { 498 name: name, 499 email: email, 500 subject: subject, 501 message: message, 502 }, 503 cache: false, 504 beforeSend: function(result) { 505 submit.empty(); 506 submit.append('<i class="fa fa-cog fa-spin"></i> Wait...'); 507 }, 508 success: function(result) { 509 if(result.sendstatus == 1) { 510 ajaxResponse.html(result.message); 511 $form.fadeOut(500); 512 } else { 513 ajaxResponse.html(result.message); 514 } 515 } 516 }); 517 } 518 }); 519 520 /* ---------------------------------------------- /* 521 * Google Map 522 /* ---------------------------------------------- */ 523 524 map.each(function() { 525 526 var reg_exp = /\[[^(\]\[)]*\]/g; 527 528 var map_div = $(this); 529 var is_draggable = Math.max($(window).width(), window.innerWidth) > 736 ? true : false;
530 var is_street_view = ( map_div.data('street-view') ) ? true : false; 531 532 if (map_div.length > 0) { 533 534 var markers_addresses = map_div[0].getAttribute('data-addresses').match(reg_exp), 535 markers_info = map_div[0].getAttribute('data-info').match(reg_exp), 536 markers_icon = map_div.data('icon'), 537 map_zoom = map_div.data('zoom'); 538 539 var markers_values = [], map_center; 540 541 markers_addresses.forEach( function(marker_address, index) { 542 var marker_value = '{' 543 marker_value += '"latLng":' + marker_address; 544 if (index == 0) { 545 map_center = JSON.parse(marker_address); 546 }; 547 if (markers_info[index]) { 548 var marker_data = markers_info[index].replace(/\[|\]/g, ''); 549 marker_value += ', "data":"' + marker_data + '"'; 550 }; 551 marker_value += '}'; 552 markers_values.push(JSON.parse(marker_value)); 553 }); 554 555 var map_options = { 556 scrollwheel: false, 557 styles: [{"featureType":"administrative","elementType":"labels.text.fill","stylers":[{"color":"#444444"}]},{"featureType":"landscape","elementType":"all","stylers":[{"color":"#f2f2f2"}]},{"featureType":"poi","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"road","elementType":"all","stylers":[{"saturation":-100},{"lightness":45}]},{"featureType":"road.highway","elementType":"all","stylers":[{"visibility":"simplified"}]},{"featureType":"road.arterial","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"transit","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"all","stylers":[{"color":"#46bcec"},{"visibility":"on"}]}] 558 }; 559 560 map_options.center = map_center; 561 map_options.zoom = map_zoom; 562 map_options.draggable = is_draggable; 563 564 var markers_options = { 565 icon: markers_icon, 566 }; 567 568 var map_config = { 569 map: { 570 options: map_options, 571 }, 572 streetviewpanorama: { 573 options: { 574 container: $(this), 575 opts: { 576 visible: is_street_view, 577 position: map_center, 578 enableCloseButton: true, 579 scrollwheel: false, 580 } 581 } 582 }, 583 marker: { 584 values: markers_values, 585 options: markers_options, 586 events: { 587 click: function(marker, event, context) { 588 if (context.data) { 589 var map = $(this).gmap3("get"), 590 infowindow = $(this).gmap3({get:{name:"infowindow"}}); 591 if (infowindow) { 592 infowindow.open(map, marker); 593 infowindow.setContent(context.data); 594 } else { 595 $(this).gmap3({ 596 infowindow:{ 597 anchor:marker, 598 options:{content: context.data} 599 } 600 }); 601 } 602 } 603 } 604 } 605 } 606 }; 607 map_div.gmap3(map_config); 608 }; 609 }); 610 611 /* ---------------------------------------------- /* 612 * Scroll Animation 613 /* ---------------------------------------------- */ 614 615 smoothscroll.on('click', function(e) { 616 var target = this.hash; 617 var $target = $(target); 618 $('html, body').stop().animate({ 619 'scrollTop': $target.offset().top - 58 620 }, 600, 'swing'); 621 e.preventDefault(); 622 }); 623 624 /* ---------------------------------------------- /* 625 * Scroll top 626 /* ---------------------------------------------- */ 627 628 $(window).scroll(function() { 629 if ($(this).scrollTop() > 100) { 630 $('.scroll-top').addClass('scroll-top-visible'); 631 } else { 632 $('.scroll-top').removeClass('scroll-top-visible'); 633 } 634 }); 635 636 $('a[href="#top"]').on('click', function() { 637 $('html, body').animate({ scrollTop: 0 }, 'slow'); 638 return false;
639 }); 640 641 /* ---------------------------------------------- /* 642 * Parallax 643 /* ---------------------------------------------- */ 644 645 parallax.jarallax({ 646 speed: 0.4, 647 }); 648 649 }); 650 651})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.