1/*----------------------------------------------------------------------------------- 2/* Custom Scripts 3-----------------------------------------------------------------------------------*/ 4 5/* ----------------- Start Document ----------------- */ 6(function($){ 7 "use strict"; 8 $(document).ready(function(){ 9 10 /* global nevia */ 11 12/*----------------------------------------------------*/ 13/* Navigation 14/*----------------------------------------------------*/ 15 16$(".menu li").hover( 17 function () { 18 $(this).find('ul:first').css({ 19 visibility: "visible", 20 display: "none" 21 }).stop(true, true).fadeIn(100); 22 }, 23 function () { 24 $(this).find('ul:first').css({ 25 visibility: "visible", 26 display: "block" 27 }).stop(true, true).fadeOut(100); 28 } 29 ); 30 31$("select.selectnav").change(function() { 32 window.location = $(this).find("option:selected").val(); 33}); 34 35 36/* 37 Fix for sidebars problem if it's longer than content 38*/ 39window.resizesidebar = function() { 40 var windowwidth = $(window).width(); 41 if(windowwidth > 768) { 42 var contheight = Math.max($(".eleven.floated").outerHeight(true)); 43 var sbheight = Math.max($("aside.sidebar").outerHeight(true)); 44 if(contheight<sbheight) { 45 $('.eleven.floated').css('min-height',sbheight); 46 } 47 } else { 48 $('div.sidebar').css('min-height','auto'); 49 $('.eleven.floated').css('min-height','auto'); 50 } 51}; 52$(window).load(function() { 53 window.resizesidebar(); 54}); 55$(window).resize(function () { window.resizesidebar(); }); 56 57 58/*----------------------------------------------------*/ 59/* Flexslider 60 nevia values are returned by localize script 61/*----------------------------------------------------*/ 62 63 64$(window).load(function() { 65 $('.flexslider:not(.nonav)').flexslider({ 66 animation: nevia.flexanimationtype, 67 smoothHeight: true, 68 controlNav: false, 69 slideshowSpeed: nevia.flexslidespeed, 70 animationSpeed: nevia.flexanimspeed, 71 after: function(){ 72 window.resizesidebar(); 73 } 74 }); 75 $('.flexslider.nonav').flexslider({ 76 animation: nevia.flexanimationtype , 77 smoothHeight: true, 78 slideshowSpeed: nevia.flexslidespeed, 79 animationSpeed: nevia.flexanimspeed, 80 directionNav: false, 81 controlNav: false, 82 after: function(){ 83 window.resizesidebar(); 84 } 85 }); 86}); 87 88 89/*----------------------------------------------------*/ 90/* Carousel 91/*----------------------------------------------------*/ 92 93// Add classes for other carousels 94var $carousel = $('.recent-blog-jc, .recent-work-jc, .recent-products-jc, .recent-blog-jc, .clients-jc'); 95 96var scrollCount; 97function adjustScrollCount() { 98 if( $(window).width() < 768 ) { 99 scrollCount = 1; 100 } else { 101 scrollCount = 3; 102 } 103} 104 105function adjustCarouselHeight() { 106 $carousel.each(function() { 107 var $this = $(this); 108 var maxHeight = -1; 109 $this.find('li').each(function() { 110 maxHeight = maxHeight > $(this).height() ? maxHeight : $(this).height(); 111 }); 112 $this.height(maxHeight); 113 }); 114} 115 116function initCarousel() { 117 adjustCarouselHeight(); 118 adjustScrollCount(); 119 var i = 0; 120 var g = {}; 121 var choosenwrap; 122 $carousel.each(function() { 123 i++; 124 if(nevia.jcautoscroll === 'yes') { 125 choosenwrap = 'circular'; 126 } else { 127 choosenwrap = null; 128 } 129 var $this = $(this); 130 g[i] = $this.jcarousel({ 131 animation : 600, 132 scroll : scrollCount, 133 wrap: choosenwrap 134 }); 135 if(nevia.jcautoscroll === 'yes') { 136 $this.jcarouselAutoscroll({ 'target': '+='+scrollCount, 'interval': 3000 }); 137 } 138 $this.jcarousel('scroll', 0); 139 $this.prev().find('.jcarousel-prev').bind('active.jcarouselcontrol', function() { 140 $(this).addClass('active'); 141 }).bind('inactive.jcarouselcontrol', function() { 142 $(this).removeClass('active'); 143 }).jcarouselControl({ 144 target: '-='+scrollCount, 145 carousel: g[i] 146 }); 147 148 $this.prev().find('.jcarousel-next').bind('active.jcarouselcontrol', function() { 149 $(this).addClass('active'); 150 }).bind('inactive.jcarouselcontrol', function() { 151 $(this).removeClass('active'); 152 }).jcarouselControl({ 153 target: '+='+scrollCount, 154 carousel: g[i] 155 }); 156 157 $this.touchwipe({ 158 wipeLeft: function() { 159 $this.jcarousel('scroll','+='+scrollCount); 160 }, 161 wipeRight: function() { 162 $this.jcarousel('scroll','-='+scrollCount); 163 } 164 }); 165 166 }); 167} 168 169$(window).load(function(){ 170 initCarousel(); 171}); 172 173$(window).resize(function () { 174 $carousel.each(function() { 175 var $this = $(this); 176 $this.jcarousel('destroy'); 177 }); 178 initCarousel(); 179}); 180 181$(window).load(function(){
182 var thumbcarousel = $('.thumbnails.jcarousel').jcarousel({}); 183 $('.shop-prev').bind('active.jcarouselcontrol', function() { 184 $(this).addClass('active'); 185 }).bind('inactive.jcarouselcontrol', function() { 186 $(this).removeClass('active'); 187 }).jcarouselControl({ 188 target: '-=1', 189 carousel: thumbcarousel 190 }); 191 192 $('.shop-next').bind('active.jcarouselcontrol', function() { 193 $(this).addClass('active'); 194 }).bind('inactive.jcarouselcontrol', function() { 195 $(this).removeClass('active'); 196 }).jcarouselControl({ 197 target: '+=1', 198 carousel: thumbcarousel 199 }); 200}); 201 202 203/*----------------------------------------------------*/ 204/* Tabs 205/*----------------------------------------------------*/ 206 207var $tabsNav = $('.tabs-nav'), 208$tabsNavLis = $tabsNav.children('li'); 209 210$tabsNav.each(function() { 211 var $this = $(this); 212 $this.next().children('.tab-content').stop(true,true).hide() 213 .first().show(); 214 215 $this.children('li').first().addClass('active').stop(true,true).show(); 216}); 217 218$tabsNavLis.on('click', function(e) { 219 var $this = $(this); 220 221 $this.siblings().removeClass('active').end() 222 .addClass('active'); 223 224 $this.parent().next().children('.tab-content').stop(true,true).hide() 225 .siblings( $this.find('a').attr('href') ).fadeIn(); 226 227 e.preventDefault(); 228}); 229 230 231/*----------------------------------------------------*/ 232/* Accordion 233/*----------------------------------------------------*/ 234 235var $accor = $('.accordion'); 236var $trigger; 237$accor.each(function() { 238 $(this).addClass('ui-accordion ui-widget ui-helper-reset'); 239 $(this).find('h3').addClass('ui-accordion-header ui-helper-reset ui-state-default ui-accordion-icons ui-corner-all'); 240 $(this).find('div.acc-div-cont').addClass('ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom'); 241 $(this).find("div.acc-div-cont").hide().first().show(); 242 $(this).find("h3").first().removeClass('ui-accordion-header-active ui-state-active ui-corner-top').addClass('ui-accordion-header-active ui-state-active ui-corner-top'); 243 $(this).find("span").first().addClass('ui-accordion-icon-active'); 244}); 245 246$trigger = $accor.find('h3'); 247 248$trigger.on('click', function(e) { 249 var location = $(this).parent(); 250 var $triggerloc; 251 if( $(this).next().is(':hidden') ) { 252 $triggerloc = $('h3', location); 253 $triggerloc.removeClass('ui-accordion-header-active ui-state-active ui-corner-top').next().slideUp(300); 254 $triggerloc.find('span').removeClass('ui-accordion-icon-active'); 255 $(this).find('span').addClass('ui-accordion-icon-active'); 256 $(this).addClass('ui-accordion-header-active ui-state-active ui-corner-top').next().slideDown(300); 257 } 258 window.resizesidebar(); 259 e.preventDefault(); 260}); 261 262 263 264 265/*----------------------------------------------------*/ 266/* Toggle 267/*----------------------------------------------------*/ 268 269$(".toggle-container").hide(); 270$(".trigger").toggle(function(){ 271 $(this).addClass("active"); 272}, function () { 273 $(this).removeClass("active"); 274}); 275$(".trigger").click(function(){ 276 $(this).next(".toggle-container").slideToggle(); 277}); 278 279$(".trigger.opened").toggle(function(){ 280 $(this).removeClass("active"); 281}, function () { 282 $(this).addClass("active"); 283}); 284 285$(".trigger.opened").addClass("active").next(".toggle-container").show(); 286 287 288/*----------------------------------------------------*/ 289/* Tooltip 290/*----------------------------------------------------*/ 291 292$('.container').tooltip({ 293 selector: "a.tooltip" 294}); 295 296 297 298$(document).ajaxComplete(function() { 299 window.resizesidebar(); 300 }); 301 302/*----------------------------------------------------*/ 303/* Skill Bar Animation 304/*----------------------------------------------------*/ 305 306setTimeout(function(){ 307 308 $('.skill-bar .skill-bar-content').each(function() { 309 var me = $(this); 310 var perc = me.attr("data-percentage"); 311 312 var current_perc = 0; 313 314 var progress = setInterval(function() { 315 if (current_perc>=perc) { 316 clearInterval(progress); 317 } else { 318 current_perc +=1; 319 me.css('width', (current_perc)+'%'); 320 } 321 322 me.text((current_perc)+'%'); 323 324 }, 10); 325 326 }); 327 328},10); 329 330$('.notification a.close').click(function(e){
331 e.preventDefault(); 332 $(this).parent().fadeOut(); 333 334}); 335 336 337/*----------------------------------------------------*/ 338/* Fancybox2 339/*----------------------------------------------------*/ 340 341$('[rel=fancybox]').fancybox({ 342 type : 'image', 343 openEffect : 'elastic', 344 closeEffect : 'elastic', 345 nextEffect : 'elastic', 346 prevEffect : 'elastic', 347 helpers : { 348 title : { 349 type : 'inside' 350 }, 351 overlay : { 352 css : { 353 'background' : 'rgba(0, 0, 0, 0.85)' 354 } 355 } 356 } 357}); 358 359$('[rel=fancybox-gallery]').fancybox({ 360 openEffect : 'elastic', 361 closeEffect : 'elastic', 362 nextEffect : 'elastic', 363 prevEffect : 'elastic', 364 365 helpers : { 366 title : { 367 type : 'inside' 368 }, 369 buttons : {}, 370 overlay : { 371 css : { 372 'background' : 'rgba(0, 0, 0, 0.85)' 373 } 374 } 375 } 376}); 377 378$('.fancybox-media').fancybox({ 379 openEffect : 'elastic', 380 closeEffect : 'elastic', 381 helpers : { 382 media : {}, 383 overlay : { 384 css : { 385 'background' : 'rgba(0, 0, 0, 0.85)' 386 } 387 } 388 } 389 }); 390 391$('.sidebar .contact-details-alt i').removeClass('white').addClass('black'); 392/*----------------------------------------------------*/ 393/* Portfolio Filters 394/*----------------------------------------------------*/ 395 396 function DropDown(el) { 397 this.dd = el; 398 this.opts = this.dd.find('ul.option-set > li'); 399 this.placeholder = this.dd.children('span'); 400 this.val = []; 401 this.index = []; 402 this.initEvents(); 403 } 404 405 DropDown.prototype = { 406 initEvents : function() { 407 var obj = this; 408 409 obj.dd.on('click', function(event){ 410 $(this).toggleClass('active'); 411 event.stopPropagation(); 412 }); 413 obj.opts.on('click',function(){ 414 var opt = $(this); 415 obj.val = opt.text(); 416 obj.index = opt.index(); 417 obj.placeholder.text('' + obj.val); 418 }); 419 } 420 } 421 422 $(function() { 423 424 var dd = new DropDown( $('#filters') ); 425 426 $(document).click(function() { 427 $('.filters-dropdown').removeClass('active'); 428 }); 429 430 $(".option-set").click(function() { 431 $('.filters-dropdown').toggleClass('active'); 432 }); 433 434 }); 435 436 437/* ------------------ End Document ------------------ */ 438}); 439 440})(this.jQuery); 441 442 443 444jQuery( function( $ ) { 445 446 // Quantity buttons 447 448 449 $( document ).on( 'click', '.plus, .minus', function() { 450 451 // Get values 452 var $qty = $( this ).closest( '.quantity' ).find( '.qty' ), 453 currentVal = parseFloat( $qty.val() ), 454 max = parseFloat( $qty.attr( 'max' ) ), 455 min = parseFloat( $qty.attr( 'min' ) ), 456 step = $qty.attr( 'step' ); 457 458 // Format values 459 if ( ! currentVal || currentVal === '' || currentVal === 'NaN' ) currentVal = 0; 460 if ( max === '' || max === 'NaN' ) max = ''; 461 if ( min === '' || min === 'NaN' ) min = 0; 462 if ( step === 'any' || step === '' || step === undefined || parseFloat( step ) === 'NaN' ) step = 1; 463 464 // Change the value 465 if ( $( this ).is( '.plus' ) ) { 466 467 if ( max && ( max == currentVal || currentVal > max ) ) { 468 $qty.val( max ); 469 } else { 470 $qty.val( currentVal + parseFloat( step ) ); 471 } 472 473 } else { 474 475 if ( min && ( min == currentVal || currentVal < min ) ) { 476 $qty.val( min ); 477 } else if ( currentVal > 0 ) { 478 $qty.val( currentVal - parseFloat( step ) ); 479 } 480 481 } 482 483 // Trigger change event 484 $qty.trigger( 'change' ); 485 486 }); 487 488});
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.