1/* Copyright AurelienD http://themeforest.net/user/AurelienD?ref=AurelienD */ 2 3function full_width_header(transition_speed) { 4 5 var jQ = jQuery.noConflict(); 6 7 var image_displayed = false; 8 9 function fadein_caption() { 10 var c = jQ.trim(jQ('.full-width-header .full-width-header-caption').html()); 11 if ( c != '' ) { 12 jQ('#fwh-caption').html(jQuery('.full-width-header .full-width-header-caption').html()); 13 jQ('#fwh-caption').css('display','block').animate({'left': '0px', opacity: 1}, transition_speed / 1.5); 14 } 15 } 16 17 function fadein_image() { 18 if ( !image_displayed ) { 19 jQ('.full-width-header').fadeIn(transition_speed, fadein_caption); 20 image_displayed = true; 21 } 22 } 23 if ( jQ('.full-width-header img').length == 0 ) { 24 fadein_caption(); 25 } else { 26 jQ('#full-width-header').addClass('loading'); 27 var timer_launch = setTimeout(fadein_image, 8000); //launch the fadein_next_slide function anyway. See caveats of load function: http://api.jquery.com/load-event/ 28 jQ('<img />').load(function () { 29 window.clearTimeout(timer_launch); 30 fadein_image(); 31 }).attr('src', jQ('.full-width-header img').attr('src')); 32 } 33} 34 35function full_width_slider(autoplay, pause_time, transition_speed) { 36 37 var jQ = jQuery.noConflict(); 38 39 var total_slides = 0, 40 next_slide = 1, 41 processing = false, 42 timer_slider = 0, 43 first_slide_done = false; 44 45 var total_slides = jQ('.full-width-slide').length; 46 var current_slide = total_slides; 47 48 if (total_slides < 2) { 49 jQ('#slider-button-left, #slider-button-right').css('display', 'none'); 50 } 51 52 function load_and_launch() { 53 jQ('#full-width-slider').addClass('loading'); 54 var timer_launch_slider = setTimeout(fadein_first_slide, 8000); //launch the fadein_next_slide function anyway. See caveats of load function: http://api.jquery.com/load-event/ 55 jQ('<img />').load(function () { 56 window.clearTimeout(timer_launch_slider); 57 fadein_first_slide(); 58 }).attr('src', jQ('.full-width-slide:first-child img').attr('src')); 59 } 60 61 function set_processing_to_false() { 62 processing = false; 63 } 64 65 function fadein_first_slide() { 66 if ( !first_slide_done ) { 67 first_slide_done = true; 68 fadein_next_slide(); 69 } 70 } 71 72 function remove_add_slider_class(c,n) { 73 jQ('body').removeClass('slide-' + c); 74 jQ('body').addClass('slide-' + n); 75 } 76 77 function fadein_next_slide() { 78 jQ('.full-width-slide').css({'z-index': '0'}); 79 jQ('.full-width-slide').eq(current_slide - 1).css({'z-index': '4'}); 80 jQ('.full-width-slide').eq(next_slide - 1).css('display', 'none').css({'z-index': '5'}).fadeIn(transition_speed); 81 (function(c,n) { 82 setTimeout( function() { remove_add_slider_class(c,n); }, transition_speed / 1.5 ); 83 })(current_slide, next_slide); 84 if ( jQ('.full-width-slide').eq(next_slide - 1).find('.full-width-slide-caption').length != 0 ) { 85 setTimeout(fadein_caption, transition_speed / 1.5); 86 } 87 if (autoplay) { 88 timer_slider = setTimeout(display_next_slide, pause_time); 89 } 90 setTimeout(set_processing_to_false, transition_speed * 1.5); 91 current_slide = next_slide; 92 } 93 94 function fadeout_caption() { 95 jQ('#fwh-caption').animate({left: '-50px', opacity: 0}, transition_speed / 1.5); 96 } 97 98 function fadein_caption() { 99 jQ('#fwh-caption').html(jQ('.full-width-slide').eq(next_slide - 1).find('.full-width-slide-caption').html()); 100 jQ('#fwh-caption').css('display','block').animate({'left': '0px', opacity: 1}, transition_speed / 1.5); 101 } 102 103 function display_next_slide() { 104 if (!processing) { 105 window.clearTimeout(timer_slider); 106 processing = true; 107 if (current_slide === total_slides) { 108 next_slide = 1; 109 } else { 110 next_slide = current_slide + 1; 111 } 112 if (jQ('.full-width-slide').eq(current_slide - 1).find('.full-width-slide-caption').length != 0) { 113 fadeout_caption(); 114 } 115 fadein_next_slide(); 116 } 117 } 118 119 function display_previous_slide() { 120 if (!processing) { 121 window.clearTimeout(timer_slider); 122 processing = true; 123 if (current_slide === 1) { 124 next_slide = total_slides; 125 } else { 126 next_slide = current_slide - 1; 127 } 128 if (jQ('.full-width-slide').eq(current_slide - 1).find('.full-width-slide-caption').length != 0) { 129 fadeout_caption(); 130 } 131 fadein_next_slide(); 132 } 133 } 134 135 jQuery('#slider-button-left').click(function() { 136 display_previous_slide(); 137 return false;
138 }); 139 140 jQuery('#slider-button-right').click(function() { 141 display_next_slide(); 142 return false; 143 }); 144 145 load_and_launch(); 146} 147 148function full_screen_slider(the_slider) { 149 150 var jQ = jQuery.noConflict(); 151 152 // image resolutions: 153 // 1600 x 900, 1200 x 675 -> desktops and laptops 154 // 1024 x 768, 768 x 1024 -> ipad (landscape / portrait) 155 // 480 x 320, 320 x 480 -> mobile (landscape / portrait) 156 // landscape and portrait resolutions from bigger to smaller 157 landscape_resolutions = [ 158 {'width': 1600, 'height': 900 }, 159 {'width': 1200, 'height': 675 }, 160 {'width': 800, 'height': 600 }, 161 {'width': 480, 'height': 320 } 162 ], 163 portrait_resolutions = [ 164 {'width': 768, 'height': 1024 }, 165 {'width': 320, 'height': 480 } 166 ]; 167 168 function debouncer( func , timeout ) { 169 var timeoutID , timeout = timeout || 50; 170 return function () { 171 var scope = this , args = arguments; 172 clearTimeout( timeoutID ); 173 timeoutID = setTimeout( function () { 174 func.apply( scope , Array.prototype.slice.call( args ) ); 175 } , timeout ); 176 } 177 } 178 179 function get_slider_img_resolution() { 180 var the_slider_resolution = {'width': jQ(the_slider).width(), 'height': jQ(the_slider).height()}, 181 available_resolutions = [], 182 longest_side = ''; 183 184 if ( the_slider_resolution.width > the_slider_resolution.height ) { 185 available_resolutions = landscape_resolutions; 186 longest_side = 'width'; 187 } else { 188 available_resolutions = portrait_resolutions; 189 longest_side = 'height'; 190 } 191 192 var chosen_resolution = available_resolutions[0]; 193 for (var i=0; i<available_resolutions.length; i++) { 194 if ( the_slider_resolution[longest_side] <= available_resolutions[i][longest_side] ) { 195 chosen_resolution = available_resolutions[i]; 196 } 197 } 198 return chosen_resolution; 199 } 200 201 function load_img(n_slide) { 202 if ( (n_slide > 0) && (n_slide <= number_of_slides) ) { 203 var sr = slider_img_resolution.width + 'x' + slider_img_resolution.height; 204 current_url = jQ(the_slider + ' .full-screen-slide').eq(n_slide-1).find('img').attr('scr'), 205 new_url = img_urls[n_slide-1][sr]; 206 if ( new_url != current_url ) { 207 jQ('<img style="position: absolute; visibility: hidden;" />').load(function() { 208 jQ(the_slider + ' .full-screen-slide').eq(n_slide-1).prepend(jQ(this)); 209 jQ(this).css({'display': 'none', 'visibility':'visible'}); 210 resize_imgs(); 211 jQ(this).fadeIn(function() { 212 if ( jQ(the_slider + ' .full-screen-slide').eq(n_slide-1).find('img').length > 1 ) { 213 jQ(the_slider + ' .full-screen-slide').eq(n_slide-1).find('img').eq(1).remove(); 214 } 215 if ( loading_first_image && (current_slide == 1) ) { 216 loading_first_image = false; 217 processing = false; 218 setTimeout(display_caption, 500); 219 if ( autoplay ) { 220 timer_slider = setTimeout( right_intent, pause_time ); 221 } 222 } 223 }); 224 }).attr('src', img_urls[n_slide-1][sr] ); 225 } 226 } 227 } 228 229 function load_img_around_current_slide() { 230 if ( current_slide == 1 ) { 231 load_img(2); 232 load_img(number_of_slides); 233 } else if ( current_slide == number_of_slides ) { 234 load_img(number_of_slides-1); 235 load_img(1); 236 } else { 237 load_img(current_slide-1); 238 load_img(current_slide+1); 239 } 240 } 241 242 function resize_slides() { 243 var ws = jQ(the_slider).width(), 244 hs = jQ(the_slider).height(); 245 246 jQ(the_slider + ' .full-screen-slide').css({ 'width': ws + 'px', 'height': hs + 'px' }); 247 jQ(the_slider + ' #full-screen-slider-mover').css('left', -ws * (current_slide-1) + 'px'); 248 } 249 250 function resize_imgs() { 251 var ws = jQ(the_slider).width(), 252 hs = jQ(the_slider).height(), 253 ratio_slider = ws / hs; 254 255 jQ(the_slider + ' img').each(function() { 256 var img = jQ(this), 257 ratio_img = jQ(this).width() / jQ(this).height(); 258 if ( ratio_slider < ratio_img ) { 259 img.css({'height': '100%', 'width': 'auto'}); 260 img.css({'left': '50%', 'margin-left': -Math.floor(img.width()/2) + 'px', 'margin-top': 0, 'top': 0}); 261 } else { 262 img.css({'height': 'auto', 'width': '100%'}); 263 img.css({'left': 0, 'margin-left': 0, 'margin-top': -Math.floor(img.height()/2) + 'px', 'top': '50%'}); 264 } 265 }); 266 } 267 268 function slider_buttons_position() { 269 if ( jQ(the_slider + ' #fss-caption').height() == 60 ) { 270 jQ('.fss-button-left, .fss-button-right').css('bottom','150px'); 271 } else { 272 jQ('.fss-button-left, .fss-button-right').css('bottom','120px'); 273 } 274 } 275 276 function hide_caption() { 277 jQ(the_slider + ' #fss-caption').animate({'right': '-100px', 'opacity': 0 }, animation_speed); 278 } 279 280 function display_caption() { 281 if ( captions[current_slide-1] != '') { 282 jQ(the_slider + ' #fss-caption').html(captions[current_slide-1]); 283 jQ(the_slider + ' #fss-caption').css('display','block').animate({'right': '10px', 'opacity': 1 }, animation_speed); 284 slider_buttons_position(); 285 } else { 286 jQ('.fss-button-left, .fss-button-right').css('bottom','50px'); 287 } 288 } 289 290 function after_animation() { 291 jQ('body').removeClass('slide-' + previous_slide); 292 jQ('body').addClass('slide-' + current_slide); 293 setTimeout(display_caption, animation_speed/2); 294 processing = false;
295 } 296 297 function go_to_left() { 298 current_slide--; 299 jQ(the_slider + ' #full-screen-slider-mover').animate({'left': '+=' + jQ(the_slider).width() + 'px'}, animation_speed, after_animation); 300 } 301 302 function go_to_right() { 303 current_slide++; 304 jQ(the_slider + ' #full-screen-slider-mover').animate({'left': '-=' + jQ(the_slider).width() + 'px'}, animation_speed, after_animation); 305 } 306 307 function go_to_first() { 308 current_slide = 1; 309 jQ(the_slider + ' #full-screen-slider-mover').animate({'left': 0}, animation_speed, after_animation); 310 } 311 312 function go_to_last() { 313 current_slide = number_of_slides; 314 jQ(the_slider + ' #full-screen-slider-mover').animate({'left': '-=' + jQ(the_slider).width()*(number_of_slides-1) + 'px'}, animation_speed, after_animation); 315 } 316 317 function update_position_indicator() { 318 jQ(the_slider + ' #position-indicator').html(current_slide + ' / ' + number_of_slides); 319 } 320 321 function before_move() { 322 processing = true; 323 previous_slide = current_slide; 324 clearTimeout(timer_slider); 325 hide_caption(); 326 } 327 328 function after_move() { 329 update_position_indicator(); 330 load_img_around_current_slide(); 331 if ( autoplay ) { 332 timer_slider = setTimeout( right_intent, pause_time ); 333 } 334 } 335 336 function left_intent() { 337 if ( !processing ) { 338 before_move(); 339 if ( current_slide > 1 ) { 340 go_to_left(); 341 } else { 342 go_to_last(); 343 } 344 after_move(); 345 } 346 } 347 348 function right_intent() { 349 if ( !processing ) { 350 before_move();
351 if ( current_slide < number_of_slides ) { 352 go_to_right(); 353 load_img(current_slide + 1); 354 } else { 355 go_to_first(); 356 } 357 after_move(); 358 } 359 } 360 361 jQ(the_slider + ' .fss-button-left').click(function() { 362 left_intent(); 363 return false; 364 }); 365 366 jQ(the_slider + ' .fss-button-right').click(function() { 367 right_intent(); 368 return false; 369 }); 370 371 jQ(window).resize(debouncer(function(e) { 372 var new_resolution = get_slider_img_resolution(); 373 if ( (new_resolution.width != slider_img_resolution.width) || (new_resolution.height != slider_img_resolution.height) ) { 374 slider_img_resolution = new_resolution; 375 load_img(current_slide); 376 load_img_around_current_slide(); 377 } 378 resize_slides(); 379 resize_imgs(); 380 slider_buttons_position(); 381 })); 382 383 function init() { 384 jQ('body').addClass('slide-' + current_slide); 385 number_of_slides = img_urls.length; 386 for (var i=0;i<number_of_slides;i++) { 387 jQ(the_slider + ' #full-screen-slider-mover').prepend('<div class="full-screen-slide"></div>') 388 } 389 resize_slides(); 390 load_img(current_slide); 391 load_img(current_slide+1); 392 load_img(number_of_slides); 393 update_position_indicator(); 394 if ( autoplay ) { 395 timer_slider = setTimeout( right_intent, pause_time ); 396 } 397 } 398 399 var current_slide = 1, 400 number_of_slides = 0, 401 slider_img_resolution = get_slider_img_resolution(), 402 timer_slider = 0, 403 processing = true, 404 loading_first_image = true, 405 autoplay = jQ(the_slider).data('autoplay') == 'yes', 406 animation_speed = jQ(the_slider).data('animation-speed'), 407 pause_time = jQ(the_slider).data('pause-time'), 408 img_urls = jQ(the_slider).data('img-urls'), 409 captions = jQ(the_slider).data('captions'); 410 411 init(); 412} 413 414function full_width_slider_inside(the_slider) { 415 416 var jQ = jQuery.noConflict(), 417 previous_slide = 0, 418 current_slide = 1, 419 processing = false, 420 timer_slider = 0, 421 number_of_slides = the_slider.find('img').length, 422 animation_speed = the_slider.data('animation-speed'), 423 pause_time = the_slider.data('pause-time'), 424 autoplay = the_slider.data('autoplay') == 'yes', 425 font_size = the_slider.find('.sc-fws-caption').css('font-size').replace('px',''); 426 427 function debouncer( func , timeout ) { 428 var timeoutID , timeout = timeout || 50; 429 return function () { 430 var scope = this , args = arguments; 431 clearTimeout( timeoutID ); 432 timeoutID = setTimeout( function () { 433 func.apply( scope , Array.prototype.slice.call( args ) ); 434 } , timeout ); 435 } 436 } 437 438 function hide_caption() { 439 the_slider.find('.sc-fws-caption').animate({'left': '75px', 'opacity': 0 }, animation_speed); 440 } 441 442 function display_caption() { 443 var c = the_slider.find('img').eq(current_slide-1).data('caption'); 444 jQ('body').removeClass('slide-' + previous_slide); 445 jQ('body').addClass('slide-' + current_slide); 446 if ( c != '' ) { 447 the_slider.find('.sc-fws-caption').html(the_slider.find('img').eq(current_slide-1).data('caption')).css('display','block').animate({'left': '25px', 'opacity': 1 }, animation_speed); 448 } 449 } 450 451 function go_prev() { 452 the_slider.find('img').eq(current_slide-1).fadeOut(animation_speed, function() { 453 processing = false; 454 display_caption(); 455 }); 456 previous_slide = current_slide; 457 current_slide--; 458 } 459 460 function go_next() { 461 the_slider.find('img').eq(current_slide).fadeIn(animation_speed, function() { 462 processing = false; 463 display_caption(); 464 }); 465 previous_slide = current_slide; 466 current_slide++; 467 } 468 469 function go_first() { 470 for (var i=1;i<number_of_slides-1;i++) { 471 the_slider.find('img').eq(i).css('display','none'); 472 } 473 the_slider.find('img').eq(number_of_slides-1).fadeOut(animation_speed, function() { 474 processing = false; 475 display_caption(); 476 }); 477 previous_slide = current_slide; 478 current_slide = 1; 479 } 480 481 function go_last() { 482 the_slider.find('img').eq(number_of_slides-1).fadeIn(animation_speed, function() { 483 the_slider.find('img').css('display','block'); 484 processing = false; 485 display_caption(); 486 }); 487 previous_slide = current_slide; 488 current_slide = number_of_slides; 489 } 490 491 function prev_intent() { 492 clearTimeout(timer_slider); 493 hide_caption(); 494 if ( current_slide > 1 ) { 495 go_prev(); 496 } else { 497 go_last(); 498 } 499 if ( autoplay ) { 500 timer_slider = setTimeout( next_intent, pause_time + animation_speed); 501 } 502 } 503 504 function next_intent() { 505 clearTimeout(timer_slider); 506 hide_caption();
507 if ( current_slide < number_of_slides ) { 508 go_next(); 509 } else { 510 go_first(); 511 } 512 if ( autoplay ) { 513 timer_slider = setTimeout( next_intent, pause_time + animation_speed); 514 } 515 } 516 517 the_slider.find('.sc-fws-button-left').click(function() { 518 if ( !processing ) { 519 processing = true; 520 prev_intent(); 521 } 522 return false; 523 }); 524 525 the_slider.find('.sc-fws-button-right').click(function() { 526 if ( !processing ) { 527 processing = true; 528 next_intent(); 529 } 530 return false; 531 }); 532 533 function init() { 534 jQ('<img />').load(function() { 535 jQ('body').addClass('slide-' + current_slide); 536 the_slider.find('img').eq(0).animate({'opacity':1}, animation_speed, display_caption); 537 if ( autoplay ) { 538 timer_slider = setTimeout( next_intent, pause_time ); 539 } 540 }).attr('src', the_slider.find('img').eq(0).attr('src')); 541 542 jQ(window).resize(debouncer(function(e) { 543 var w = the_slider.width(); 544 var s = Math.floor( (w/982)*font_size ) + 2; 545 s = s + 'px'; 546 the_slider.find('.sc-fws-caption').css({'font-size': s, 'line-height': s}); 547 })).resize(); 548 } 549 550 init(); 551} 552 553function slider_type_a(the_slider) { 554 555 var jQ = jQuery.noConflict(); 556 var cs = 0; 557 var processing = false; 558 var timer_slider = 0; 559 560 jQ(window).load(function(){ 561 var h = the_slider.find('.slider-content-slide').eq(0).height(); 562 the_slider.find('.slider-content-second-container').height(h); 563 }); 564 565 if ( the_slider.find('.slider-content-slide').length > 1 ){ 566 the_slider.find('.slider-content-button-left-disabled').css('display', 'block'); 567 the_slider.find('.slider-content-button-right').css('display', 'block'); 568 } 569 570 function set_timer() { 571 if ( the_slider.data('autoplay') != 'no' ) { 572 timer_slider = setInterval(display_next_slide, the_slider.data('autoplay')); 573 } 574 } 575 set_timer(); 576 577 function display_next_slide() { 578 if ( !processing ) { 579 if ( cs < the_slider.find('.slider-content-slide').length - 1 ) { 580 go_to_right(); 581 } else { 582 go_to_first(); 583 } 584 } 585 } 586 587 function go_to_first() { 588 processing = true; 589 clearTimeout(timer_slider); 590 the_slider.find('.slider-content-button-right-disabled').css('display', 'none'); 591 the_slider.find('.slider-content-button-right').css('display', 'block'); 592 the_slider.find('.slider-content-button-left').css('display', 'none'); 593 the_slider.find('.slider-content-button-left-disabled').css('display', 'block'); 594 the_slider.find('.slider-content-slide').css('display', 'block'); 595 var w = the_slider.find('.slider-content-slide').width(); 596 w = w + 30; 597 w = w * (the_slider.find('.slider-content-slide').length - 1); 598 the_slider.find('.slider-content-third-container').css({left: '-' + w + 'px'}); 599 the_slider.find('.slider-content-third-container').animate({left: 0}, function() { 600 cs = 0; 601 processing = false; 602 set_timer(); 603 }); 604 var h = the_slider.find('.slider-content-slide').eq(0).height(); 605 the_slider.find('.slider-content-second-container').animate({height: h + 'px'}); 606 } 607 608 function go_to_left() { 609 processing = true; 610 clearTimeout(timer_slider); 611 the_slider.find('.slider-content-button-right-disabled').css('display', 'none'); 612 the_slider.find('.slider-content-button-right').css('display', 'block'); 613 if ( cs == 1 ) { 614 the_slider.find('.slider-content-button-left').css('display', 'none'); 615 the_slider.find('.slider-content-button-left-disabled').css('display', 'block'); 616 } 617 var w = the_slider.find('.slider-content-slide').width(); 618 w = w + 30; 619 the_slider.find('.slider-content-slide').eq(cs-1).css('display', 'block'); 620 the_slider.find('.slider-content-third-container').css({left: '-' + w + 'px'}); 621 the_slider.find('.slider-content-third-container').animate({left: 0}, function() { 622 cs--; 623 processing = false; 624 set_timer(); 625 }); 626 var h = the_slider.find('.slider-content-slide').eq(cs-1).height(); 627 the_slider.find('.slider-content-second-container').animate({height: h + 'px'}); 628 } 629 630 function go_to_right() { 631 processing = true; 632 clearTimeout(timer_slider); 633 the_slider.find('.slider-content-button-left-disabled').css('display', 'none'); 634 the_slider.find('.slider-content-button-left').css('display', 'block'); 635 if ( cs + 1 == the_slider.find('.slider-content-slide').length - 1 ) { 636 the_slider.find('.slider-content-button-right').css('display', 'none'); 637 the_slider.find('.slider-content-button-right-disabled').css('display', 'block'); 638 } 639 var w = the_slider.find('.slider-content-slide').width(); 640 w = w + 30; 641 the_slider.find('.slider-content-third-container').animate({left: '-=' + w}, function() { 642 the_slider.find('.slider-content-slide').eq(cs).css('display', 'none'); 643 the_slider.find('.slider-content-third-container').css({left: 0}); 644 cs++; 645 processing = false;
646 set_timer(); 647 }); 648 var h = the_slider.find('.slider-content-slide').eq(cs+1).height(); 649 the_slider.find('.slider-content-second-container').animate({height: h + 'px'}); 650 } 651 652 653 the_slider.find('.slider-content-button-left').click(function() { 654 if ( !processing ) { 655 go_to_left(); 656 } 657 return false; 658 }); 659 660 the_slider.find('.slider-content-button-right').click(function() { 661 if ( !processing ) { 662 go_to_right(); 663 } 664 return false; 665 }); 666 667 jQ(window).resize(function() { 668 var h = the_slider.find('.slider-content-slide').eq(cs).height(); 669 the_slider.find('.slider-content-second-container').css({height: h + 'px'}); 670 }); 671 672} 673 674function slider_type_b(the_slider) { 675 676 var jQ = jQuery.noConflict(); 677 var cs = 0; 678 var processing = false; 679 var timer_slider = 0; 680 681 function get_cols_num() { 682 var w = the_slider.find('.slider-content-slide').width(); 683 if ( ( w == 373 ) || ( w == 282 ) ) { 684 return 2; 685 } else { 686 return 1; 687 } 688 } 689 690 function set_timer() { 691 if ( the_slider.data('autoplay') != 'no' ) { 692 timer_slider = setInterval(display_next_slide, the_slider.data('autoplay')); 693 } 694 } 695 set_timer(); 696 697 function display_next_slide() { 698 if ( !processing ) { 699 if ( cs < the_slider.find('.slider-content-slide').length - get_cols_num() ) { 700 go_to_right(); 701 } else { 702 go_to_first(); 703 } 704 } 705 } 706 707 jQ(window).load(function(){ 708 set_height(0,'no-anim'); 709 }); 710 711 function set_buttons(cs) { 712 if ( ((get_cols_num() == 2) && (the_slider.find('.slider-content-slide').length <= 2)) || ((get_cols_num() == 1) && (the_slider.find('.slider-content-slide').length <= 1)) ) { 713 the_slider.find('.slider-content-button-left-disabled').css('display', 'none'); 714 the_slider.find('.slider-content-button-right-disabled').css('display', 'none'); 715 the_slider.find('.slider-content-button-left').css('display', 'none'); 716 the_slider.find('.slider-content-button-right').css('display', 'none'); 717 return; 718 } 719 the_slider.find('.slider-content-button-left').css('display', 'block'); 720 the_slider.find('.slider-content-button-right').css('display', 'block'); 721 the_slider.find('.slider-content-button-left-disabled').css('display', 'none'); 722 the_slider.find('.slider-content-button-right-disabled').css('display', 'none'); 723 if ( cs == 0 ) { 724 the_slider.find('.slider-content-button-left-disabled').css('display', 'block'); 725 the_slider.find('.slider-content-button-left').css('display', 'none'); 726 return; 727 } 728 if ( (cs == the_slider.find('.slider-content-slide').length - 1) || ((get_cols_num() == 2) && (cs == the_slider.find('.slider-content-slide').length - 2)) ) { 729 the_slider.find('.slider-content-button-right-disabled').css('display', 'block'); 730 the_slider.find('.slider-content-button-right').css('display', 'none'); 731 return; 732 } 733 } 734 set_buttons(0); 735 736 function set_height(cs,a) { 737 var h = the_slider.find('.slider-content-slide').eq(cs).height(); 738 if ( get_cols_num() == 2 ) { 739 var h2 = the_slider.find('.slider-content-slide').eq(cs+1).height(); 740 if ( h2 > h ) { 741 h = h2; 742 } 743 } 744 h = h + 20 + 2; //padding + borders 745 if (a == 'anim') { 746 the_slider.find('.slider-content-second-container').animate({height: h + 'px'}); 747 } else { 748 the_slider.find('.slider-content-second-container').css({height: h + 'px'}); 749 } 750 } 751 752 function go_to_first() { 753 processing = true; 754 clearTimeout(timer_slider); 755 set_buttons(0); 756 set_height(0,'anim'); 757 var w = the_slider.find('.slider-content-slide').width(); 758 w = w + 40 + 2 + 40; //padding + borders + margin 759 w = w * (the_slider.find('.slider-content-slide').length - get_cols_num()); 760 the_slider.find('.slider-content-slide').css('display', 'block'); 761 the_slider.find('.slider-content-third-container').css({left: '-' + w + 'px'}); 762 the_slider.find('.slider-content-third-container').animate({left: 0}, function() { 763 cs = 0; 764 set_timer(); 765 processing = false; 766 }); 767 } 768 769 function go_to_left() { 770 processing = true; 771 clearTimeout(timer_slider); 772 set_buttons(cs-1); 773 set_height(cs-1,'anim'); 774 var w = the_slider.find('.slider-content-slide').width(); 775 w = w + 40 + 2 + 40; //padding + borders + margin 776 the_slider.find('.slider-content-slide').eq(cs-1).css('display', 'block'); 777 the_slider.find('.slider-content-third-container').css({left: '-' + w + 'px'}); 778 the_slider.find('.slider-content-third-container').animate({left: 0}, function() { 779 cs--; 780 set_timer(); 781 processing = false;
782 }); 783 } 784 785 function go_to_right() { 786 processing = true; 787 clearTimeout(timer_slider); 788 set_buttons(cs+1); 789 set_height(cs+1,'anim'); 790 var w = the_slider.find('.slider-content-slide').width(); 791 w = w + 40 + 2 + 40; //padding + borders + margin 792 the_slider.find('.slider-content-third-container').animate({left: '-=' + w}, function() { 793 the_slider.find('.slider-content-slide').eq(cs).css('display', 'none'); 794 the_slider.find('.slider-content-third-container').css({left: 0}); 795 cs++; 796 set_timer(); 797 processing = false; 798 }); 799 } 800 801 the_slider.find('.slider-content-button-left').click(function() { 802 if ( !processing ) { 803 go_to_left(); 804 } 805 return false; 806 }); 807 808 the_slider.find('.slider-content-button-right').click(function() { 809 if ( !processing ) { 810 go_to_right(); 811 } 812 return false; 813 }); 814 815 jQ(window).resize(function() { 816 set_buttons(cs); 817 if ( get_cols_num() == 2 ) { 818 var n = the_slider.find('.slider-content-slide').length; 819 if ( cs == n - 1 ) { 820 the_slider.find('.slider-content-slide').eq(n-1).css('display', 'block'); 821 the_slider.find('.slider-content-slide').eq(n-2).css('display', 'block'); 822 cs--; 823 } 824 } 825 set_height(cs,'no-anim'); 826 }); 827} 828 829function gallery_ap() { 830 831 var jQ = jQuery.noConflict(); 832 833 jQ('.gallery-ap .gallery-slider a:first-child').addClass('gallery-current-thumb'); 834 jQ('.gallery-ap .gallery-slider a').hover( 835 function () { 836 jQ(this).find('img').animate({'opacity': 1});; 837 }, 838 function () { 839 if ( !jQ(this).hasClass('gallery-current-thumb') ) { 840 jQ(this).find('img').animate({'opacity': 0.3}); 841 } 842 } 843 ); 844 845 jQ('.gallery-slide a').click(function() { 846 if ( !jQ(this).hasClass('gallery-current-thumb') ) { 847 jQ('.gallery-current-thumb').find('img').animate({'opacity': 0.3}); 848 } 849 jQ('.gallery-ap .gallery-slider a').removeClass('gallery-current-thumb'); 850 jQ(this).addClass('gallery-current-thumb'); 851 var g = jQ(this).parents('.gallery-ap').find('.gallery-big-image'); 852 var light_box_all = ''; 853 if ( jQ(this).parents('.gallery-ap').find('.gallery-ap-light-box').length > 0 ) { 854 light_box_all = jQ(this).parents('.gallery-ap').find('.gallery-ap-light-box').data('light-box-all'); 855 } 856 var h = g.height(); 857 g.css('height', h + 'px'); 858 g.html(''); 859 var s = jQ(this).attr('href'); 860 var full_size_src = jQ(this).data('full-size-src'); 861 jQ('<img class="img-gallery-ap-full-size" />').attr('src', s).load(function() { 862 jQ(this).hide(); 863 if ( full_size_src != '' ) { 864 g.html('<a href="' + full_size_src + '" class="gallery-ap-light-box" data-light-box-all="' + light_box_all + '"></a>'); 865 g.find('a').html(jQ(this)); 866 } else { 867 g.html(jQ(this)); 868 } 869 jQ(this).fadeIn(); 870 h = jQ(this).height(); 871 g.animate({'height': h + 'px'}); 872 }); 873 return false; 874 }); 875 876 jQ('.gallery-ap').on('click','.gallery-ap-light-box', function() { 877 if ( jQ(this).data('light-box-all') == 'yes' ) { 878 var p = [jQ(this).attr('href')]; 879 jQ('.gallery-slider a').each(function() { 880 var n = jQ(this).data('full-size-src'); 881 if ( jQ.inArray(n,p) < 0 ) { 882 p.push(n); 883 } 884 }); 885 jQ.prettyPhoto.open(p); 886 } else { 887 jQ.prettyPhoto.open(jQ(this).attr('href')); 888 } 889 return false; 890 }); 891 892 function slide_amount(gs) { 893 var w = gs.parents('.gallery-ap').find('.gallery-big-image').width(); 894 var thumbs_width = gs.find('img').width(); 895 var thumbs_margin = parseInt(gs.find('img').css('margin-right').replace('px','')); 896 var visible_thumbs_number = parseInt((w + thumbs_margin)/(thumbs_width + thumbs_margin)); 897 return visible_thumbs_number * (thumbs_margin + thumbs_width); 898 } 899 900 function go_to_left(gs) { 901 gs.data('processing', 'yes'); 902 gs.find('.gallery-slide').animate({'left': '+=' + slide_amount(gs) + 'px'}, function() { 903 set_buttons(); 904 gs.data('processing', 'no'); 905 }); 906 } 907 908 function go_to_right(gs) { 909 gs.data('processing', 'yes'); 910 gs.find('.gallery-slide').animate({'left': '-=' + slide_amount(gs) + 'px'}, function() { 911 set_buttons(); 912 gs.data('processing', 'no'); 913 }); 914 } 915 916 jQ('.gallery-ap .slider-content-button-left').click(function() { 917 var gs = jQ(this).parents('.gallery-ap').find('.gallery-slider'); 918 if ( gs.data('processing') == 'no' ) { 919 go_to_left(gs); 920 } 921 return false;
922 }); 923 924 jQ('.gallery-ap .slider-content-button-right').click(function() { 925 var gs = jQ(this).parents('.gallery-ap').find('.gallery-slider'); 926 if ( gs.data('processing') == 'no' ) { 927 go_to_right(gs); 928 } 929 return false; 930 }); 931 932 function set_buttons() { 933 jQ('.gallery-ap').each(function() { 934 if ( jQ(this).find('.gallery-slide').position().left == 0 ) { 935 jQ(this).find('.slider-content-button-left-disabled').css('display','block'); 936 jQ(this).find('.slider-content-button-left').css('display','none'); 937 938 } else { 939 jQ(this).find('.slider-content-button-left-disabled').css('display','none'); 940 jQ(this).find('.slider-content-button-left').css('display','block'); 941 } 942 var l = jQ(this).find('.gallery-slide').position().left; 943 var wi = jQ(this).find('.gallery-big-image').width(); 944 var thumbs_number = jQ(this).find('.gallery-slide img').length; 945 var thumbs_width = jQ(this).find('.gallery-slide img').width(); 946 var thumbs_margin = parseInt(jQ(this).find('.gallery-slide img').css('margin-right').replace('px','')); 947 var wt = thumbs_number * (thumbs_width + thumbs_margin) - thumbs_margin; 948 if ( wt + l < wi + 1 ) { 949 jQ(this).find('.slider-content-button-right-disabled').css('display','block'); 950 jQ(this).find('.slider-content-button-right').css('display','none'); 951 } else { 952 jQ(this).find('.slider-content-button-right-disabled').css('display','none'); 953 jQ(this).find('.slider-content-button-right').css('display','block'); 954 } 955 }); 956 } 957 958 set_buttons(); 959 960 function debouncer( func , timeout ) { 961 var timeoutID , timeout = timeout || 200; 962 return function () { 963 var scope = this , args = arguments; 964 clearTimeout( timeoutID ); 965 timeoutID = setTimeout( function () { 966 func.apply( scope , Array.prototype.slice.call( args ) ); 967 } , timeout ); 968 } 969 } 970 971 function after_resize() { 972 jQ('.gallery-ap').each(function() { 973 var gallery_ap = jQ(this); 974 var w = gallery_ap.find('.gallery-big-image').width(); 975 var h = gallery_ap.find('.gallery-big-image img').height(); 976 if ( h != 0 ) { 977 gallery_ap.find('.gallery-big-image').animate({'height': h + 'px'}); 978 } 979 var nb_thumbs = gallery_ap.find('.gallery-slider img').length; 980 var thumbs_width = gallery_ap.find('.gallery-slider img').width(); 981 var thumbs_margin = parseInt(gallery_ap.find('.gallery-slider img').css('margin-right').replace('px','')); 982 var w2 = nb_thumbs * (thumbs_width + thumbs_margin) - thumbs_margin; 983 if ( w2 > w ) { 984 gallery_ap.find('.gallery-controls').slideDown(); 985 } else { 986 gallery_ap.find('.gallery-controls').slideUp(); 987 } 988 }); 989 jQ('.gallery-ap .gallery-slide').animate({'left': 0}, function() { 990 jQ(this).css({'left': 0}); 991 set_buttons(); 992 }); 993 } 994 995 after_resize(); 996 997 jQ(window).resize(debouncer(function(e) { 998 after_resize(); 999 })); 1000} 1001 1002/* Copyright AurelienD http://themeforest.net/user/AurelienD?ref=AurelienD */
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.