1 2/* 3 * Author: Digital Zoom Studio 4 * Website: http://digitalzoomstudio.net/ 5 * Portfolio: http://codecanyon.net/user/ZoomIt/portfolio 6 * 7 * Version: 2.63 8 * 9 */ 10 11//"use strict"; 12 13window.dzsprx_self_options = {}; 14 15(function($) { 16 17 $.fn.dzsparallaxer = function(o) { 18 19 var defaults = { 20 settings_mode : 'scroll' // scroll or mouse or mouse_body or oneelement 21 , mode_scroll : 'normal' // -- normal or fromtop 22 , easing : 'easeIn' // -- easeIn or easeOutQuad or easeInOutSine 23 , animation_duration : '20' // -- animation duration in ms 24 , direction: 'normal' // -- normal or reverse 25 , js_breakout: 'off' // -- if on it will try to breakout of the container and cover fullwidth 26 , breakout_fix: 'off' // -- if you are using a div breakout this will add classes and tagnames back 27 , is_fullscreen: 'off' // -- if this is fullscreen parallaxer, then we can just follow 28 ,settings_movexaftermouse: "off" // -- if on the parallax will move after the mouse 29 ,init_delay: "0" // -- a delay on which to start the init function 30 ,init_functional_delay: "0" // -- a delay on which to start the parallax movement 31 ,settings_substract_from_th: 0 // -- if you only want to show some part of the image you can substract pixels from the total height 32 ,settings_detect_out_of_screen: true // -- detect if the parallax is outside the viewable area and not animate handleframe 33 ,init_functional_remove_delay_on_scroll: "off" // -- remove the delay on which to start the parallax movement 34 ,settings_makeFunctional: false 35 ,settings_scrollTop_is_another_element_top: null // -- an object on which the scroll is actually simulated into an elements top position 36 37 ,settings_clip_height_is_window_height: false // -- replace the clip height to the window height 38 ,settings_listen_to_object_scroll_top: null // -- replace the scroll top listening with a value from the outside 39 ,settings_mode_oneelement_max_offset : '20' 40 ,simple_parallaxer_convert_simple_img_to_bg_if_possible:"on" 41 } 42 43 if(typeof o =='undefined'){ 44 if(typeof $(this).attr('data-options')!='undefined' && $(this).attr('data-options')!=''){ 45 var aux = $(this).attr('data-options'); 46 aux = 'window.dzsprx_self_options = ' + aux; 47 eval(aux); 48 o = $.extend({},window.dzsprx_self_options); 49 window.dzsprx_self_options = $.extend({},{}); 50 } 51 } 52 53 54 o = $.extend(defaults, o); 55 56 57 58 Math.easeIn = function(t, b, c, d) { 59 60 return -c *(t/=d)*(t-2) + b; 61 62 }; 63 64 Math.easeOutQuad = function (t, b, c, d) { 65 t /= d; 66 return -c * t*(t-2) + b; 67 }; 68 Math.easeInOutSine = function (t, b, c, d) { 69 return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; 70 }; 71 72 o.settings_mode_oneelement_max_offset = parseInt(o.settings_mode_oneelement_max_offset,10); 73 var simple_parallaxer_max_offset = parseInt(o.settings_mode_oneelement_max_offset,10); 74 75 this.each( function(){ 76 var cthis = $(this); 77 var _theTarget = null 78 ,_blackOverlay = null 79 ,_fadeouttarget = null 80 ; 81 82 var nritems = 0 83 ,tobeloaded=0 84 ; 85 var i =0; 86 87 var tw = 0 88 ,th = 0 89 ,ch = 0 90 ,cw = 0 91 ,ww = 0 92 ,wh = 0 93 ,last_wh = 0 // -- compare to the last known last wh 94 ,last_cthis_ot = 0 // -- compare to the last known last wh 95 ,initialheight = 0 96 ; 97 98 var int_calculate_dims = 0; 99 100 101 // Starting time and duration. 102 103 // Starting Target, Begin, Finish & Change 104 // --- easing params 105 106 var duration_viy = 0 107 ; 108 109 var target_viy = 0 110 ,target_vix = 0 111 ,target_bo = 0 112 ; 113 114 var begin_viy = 0 115 ,begin_vix = 0 116 ,begin_bo = 0 117 ; 118 119 var finish_viy = 0 120 ,finish_vix = 0 121 ,finish_bo = 0 122 ; 123 124 var change_viy = 0 125 ,change_vix = 0 126 ,change_bo = 0 127 ; 128 129 var backup_duration_viy = 0 130 var api_outer_update_func = null 131 ,_scrollTop_is_another_element_top = null 132 ; 133 134 135 var st = 0 //--scroll top 136 ,vi_y = 0 // -- view index y 137 ,bo_o = 0 // -- black offset opacity 138 ,cthis_ot = 0 //--offset top 139 ; 140 141 var lazyloading_setsource = ''; 142 143 var started = false 144 ,debug_var = false 145 ; 146 147 var animator_objects_arr = null; 148 149 var stop_enter_frame = false 150 ,sw_suspend_functional = false 151 ,sw_stop_enter_frame = false 152 ,sw_out_of_display = false 153 154 ; 155
156 var init_delay = 0 157 ,init_functional_delay = 0 158 ; 159 160 var inter_debug_func=0 161 ,inter_suspend_enter_frame = 0 162 ,inter_scroll_from_resize = 0 163 ,inter_recheck_dims = 0 164 ; 165 166 // -- some rresponsive scaling options 167 168 var responsive_reference_width = 0 169 ,responsive_optimal_height = 0 170 ; 171 172 173 174 init_delay = Number(o.init_delay); 175 init_functional_delay = Number(o.init_functional_delay); 176 177 178 if(init_delay){ 179 setTimeout(init, init_delay); 180 }else{ 181 182 init(); 183 } 184 185 function init(){ 186 187 188 //console.warn('init()',cthis); 189 if (o.settings_makeFunctional == true) { 190 var allowed = false; 191 192 var url = document.URL; 193 var urlStart = url.indexOf("://") + 3; 194 var urlEnd = url.indexOf("/", urlStart); 195 var domain = url.substring(urlStart, urlEnd); 196 //console.log(domain); 197 if (domain.indexOf('l') > -1 && domain.indexOf('c') > -1 && domain.indexOf('o') > -1 && domain.indexOf('l') > -1 && domain.indexOf('a') > -1 && domain.indexOf('h') > -1) { 198 allowed = true; 199 } 200 if (domain.indexOf('d') > -1 && domain.indexOf('i') > -1 && domain.indexOf('g') > -1 && domain.indexOf('d') > -1 && domain.indexOf('z') > -1 && domain.indexOf('s') > -1) { 201 allowed = true; 202 } 203 if (domain.indexOf('o') > -1 && domain.indexOf('z') > -1 && domain.indexOf('e') > -1 && domain.indexOf('h') > -1 && domain.indexOf('t') > -1) { 204 allowed = true; 205 } 206 if (domain.indexOf('e') > -1 && domain.indexOf('v') > -1 && domain.indexOf('n') > -1 && domain.indexOf('a') > -1 && domain.indexOf('t') > -1) { 207 allowed = true; 208 } 209 if (allowed == false) { 210 return; 211 } 212 213 } 214 215 216 if(o.settings_scrollTop_is_another_element_top){ 217 _scrollTop_is_another_element_top = o.settings_scrollTop_is_another_element_top; 218 } 219 220 221 222 _theTarget = cthis.find('.dzsparallaxer--target').eq(0); 223 if(cthis.find('.dzsparallaxer--blackoverlay').length>0){ 224 _blackOverlay = cthis.find('.dzsparallaxer--blackoverlay').eq(0); 225 } 226 if(cthis.find('.dzsparallaxer--fadeouttarget').length>0){ 227 _fadeouttarget = cthis.find('.dzsparallaxer--fadeouttarget').eq(0); 228 } 229 230 if(!cthis.hasClass('wait-readyall')){ 231 setTimeout(function(){ 232 duration_viy = Number(o.animation_duration); 233 },300); 234 } 235 236 cthis.addClass('mode-'+o.settings_mode); 237 238 //console.info(cthis,_theTarget, o); 239 240 241 //console.info(duration_viy); 242 243 //console.info(cthis,_theTarget,_blackOverlay, o); 244 245 246 ch = cthis.height(); 247 if(o.settings_movexaftermouse=='on'){ 248 cw = cthis.width(); 249 } 250 251 if(_theTarget){ 252 th = _theTarget.height(); 253 if(o.settings_movexaftermouse=='on'){ 254 tw = _theTarget.width(); 255 } 256 } 257 if(o.settings_substract_from_th){ 258 th-= o.settings_substract_from_th; 259 } 260 261 262 //console.info(cthis,ch); 263 264 265 initialheight = ch; 266 267 if(o.breakout_fix=='2'){ 268 console.info(cthis.prev()); 269 } 270 271 if(cthis.attr('data-responsive-reference-width')){ 272 responsive_reference_width = Number(cthis.attr('data-responsive-reference-width')); 273 } 274 if(cthis.attr('data-responsive-optimal-height')){ 275 responsive_optimal_height = Number(cthis.attr('data-responsive-optimal-height')); 276 } 277 278 //console.log(cthis, responsive_reference_width, responsive_optimal_height); 279 280
281 //console.info(is_touch_device()); 282 283 if(cthis.find('.dzsprxseparator--bigcurvedline').length>0){ 284 cthis.find('.dzsprxseparator--bigcurvedline').append('<svg class="display-block" width="100%" viewBox="0 0 2500 100" preserveAspectRatio="none" ><path class="color-bg" fill="#FFFFFF" d="M2500,100H0c0,0-24.414-1.029,0-6.411c112.872-24.882,2648.299-14.37,2522.026-76.495L2500,100z"/></svg>'); 285 } 286 287 if(cthis.find('.dzsprxseparator--2triangles').length>0){ 288 cthis.find('.dzsprxseparator--2triangles').append('<svg class="display-block" width="100%" viewBox="0 0 1500 100" preserveAspectRatio="none" ><polygon class="color-bg" fill="#FFFFFF" points="1500,100 0,100 0,0 750,100 1500,0 "/></svg>'); 289 } 290 if(cthis.find('.dzsprxseparator--triangle').length>0){ 291 cthis.find('.dzsprxseparator--triangle').append('<svg class="display-block" width="100%" viewBox="0 0 2200 100" preserveAspectRatio="none" ><polyline class="color-bg" fill="#FFFFFF" points="2200,100 0,100 0,0 2200,100 "/></svg>'); 292 } 293 294 295 if(cthis.get(0)){ 296 cthis.get(0).api_set_scrollTop_is_another_element_top = function(arg){ 297 //console.info('actually!! api_set_scrollTop_is_another_element_top', arg); 298 _scrollTop_is_another_element_top = arg; 299 } 300 } 301 302 // console.info('is_touch_device - ', is_touch_device()); 303 304 if(is_touch_device()){ 305 cthis.addClass('is-touch'); 306 } 307 if(is_mobile()){ 308 cthis.addClass('is-mobile'); 309 } 310 311 if(cthis.find('.divimage').length>0 || cthis.find('img').length>0){ 312 var _loadTarget = cthis.children('.divimage, img').eq(0); 313 //console.info(_loadTarget.attr('data-src')); 314 315 if(_loadTarget.attr('data-src')){ 316 lazyloading_setsource = _loadTarget.attr('data-src'); 317 $(window).on('scroll',handle_scroll); 318 handle_scroll(); 319 320 }else{ 321 init_start(); 322 } 323 }else{ 324 325 init_start(); 326 } 327 328 329 330 331 } 332 333 function init_start(){ 334 335 if(started){ 336 return; 337 } 338 started = true; 339 340 //console.info(is_ie, is_ie(), version_ie(), is_ie11()); 341 if(is_ie11()){ 342 cthis.addClass('is-ie-11'); 343 } 344 345 346 347 //$(window).unbind('resize',handle_resize); 348 $(window).bind('resize',handle_resize); 349 handle_resize(); 350 351 inter_recheck_dims = setInterval(function(){ 352 handle_resize(null, { 353 'call_from': 'autocheck' 354 }) 355 },2000); 356 357 if(cthis.hasClass('wait-readyall')){ 358 setTimeout(function(){ 359 handle_scroll(); 360 },700); 361 } 362 363 setTimeout(function(){ 364 cthis.addClass('dzsprx-readyall'); 365 handle_scroll(); 366 367 if(cthis.hasClass('wait-readyall')) { 368 duration_viy = Number(o.animation_duration); 369 } 370 },1000); 371 372 if(cthis.find('*[data-parallaxanimation]').length>0) { 373 cthis.find('*[data-parallaxanimation]').each(function () { 374 var _t = $(this); 375 //console.info(_t); 376 377 if(_t.attr('data-parallaxanimation')){ 378 if(animator_objects_arr==null){ 379 animator_objects_arr = []; 380 } 381 382 animator_objects_arr.push(_t); 383 384 385 var aux = _t.attr('data-parallaxanimation'); 386 aux = 'window.aux_opts2 = ' + aux; 387 aux = aux.replace(/'/g, '"') 388 // console.info(aux); 389 try { 390 eval(aux); 391 } 392 catch(err) { 393 console.info(aux, err); 394 window.aux_opts2=null; 395 } 396 //console.info(aux_opts2); 397 398 if(window.aux_opts2){ 399 for(i=0;i<window.aux_opts2.length;i++){ 400 if(isNaN(Number(window.aux_opts2[i].initial))==false){ 401 window.aux_opts2[i].initial = Number(window.aux_opts2[i].initial); 402 } 403 if(isNaN(Number(window.aux_opts2[i].mid))==false){ 404 window.aux_opts2[i].mid = Number(window.aux_opts2[i].mid); 405 } 406 if(isNaN(Number(window.aux_opts2[i].final))==false){ 407 window.aux_opts2[i].final = Number(window.aux_opts2[i].final); 408 } 409 } 410 _t.data('parallax_options', window.aux_opts2); 411 //console.info(_t, _t.data('parallax_options')); 412 } 413 414 } 415 416 }); 417 } 418 419 //console.info(animator_objects_arr); 420 421 if(init_functional_delay){ 422 sw_suspend_functional = true; 423 //console.info('CEVA'); 424 425 setTimeout(function(){ 426 sw_suspend_functional = false;
427 },init_functional_delay) 428 } 429 430 431 if(!cthis.hasClass('simple-parallax')){ 432 handle_frame(); 433 }else{ 434 _theTarget.wrap('<div class="simple-parallax-inner"></div>'); 435 436 console.info() 437 438 if(o.simple_parallaxer_convert_simple_img_to_bg_if_possible=='on' && _theTarget.attr('data-src') && _theTarget.children().length==0){ 439 _theTarget.parent().addClass('is-image'); 440 } 441 442 443 444 if(simple_parallaxer_max_offset>0){ 445 handle_frame(); 446 } 447 } 448 449 inter_debug_func = setInterval(debug_func, 1000); 450 451 452 setTimeout(function(){ 453 //finish.y = -300; 454 }, 1500); 455 456 457 if(cthis.hasClass('use-loading')){ 458 if(cthis.find('.divimage').length>0 || cthis.children('img').length>0){ 459 if(cthis.find('.divimage').length>0){ 460 if(lazyloading_setsource){ 461 cthis.find('.divimage').eq(0).css('background-image','url('+lazyloading_setsource+')'); 462 } 463 var _loadTarget_src = (String(cthis.find('.divimage').eq(0).css('background-image')).split('"'))[1]; 464 if(_loadTarget_src == undefined){ 465 _loadTarget_src = (String(cthis.find('.divimage').eq(0).css('background-image')).split('url('))[1]; 466 _loadTarget_src = (String(_loadTarget_src).split(')'))[0]; 467 } 468 var _loadTarget = new Image(); 469 470 //console.info(cthis.find('.divimage').eq(0).css('background-image'), _loadTarget_src); 471 472 _loadTarget.onload = function(e){ 473 cthis.addClass('loaded'); 474 }; 475 476 477 478 _loadTarget.src = _loadTarget_src; 479 480 } 481 }else{ 482 483 cthis.addClass('loaded'); 484 } 485 486 setTimeout(function(){ 487 cthis.addClass('loaded'); 488 calculate_dims(); 489 }, 10000) 490 } 491 492 493 cthis.get(0).api_set_update_func = function(arg){ 494 api_outer_update_func = arg; 495 } 496 cthis.get(0).api_handle_scroll = handle_scroll; 497 cthis.get(0).api_destroy = destroy; 498 cthis.get(0).api_destroy_listeners = destroy_listeners; 499 500 501 if(o.settings_mode == 'scroll' || o.settings_mode=='oneelement'){ 502 $(window).off('scroll',handle_scroll); 503 $(window).on('scroll',handle_scroll); 504 handle_scroll(); 505 setTimeout(handle_scroll,1000); 506 507 if(document && document.addEventListener){ 508 509 document.addEventListener("touchmove", handle_mousemove, false); 510 } 511 512 513 } 514 515 if(o.settings_mode == 'mouse_body' || o.settings_movexaftermouse=='on'){ 516 $(document).bind('mousemove', handle_mousemove); 517 } 518 } 519 520 function destroy(){ 521 api_outer_update_func = null; 522 stop_enter_frame = true; 523 api_outer_update_func = null; 524 $(window).off('scroll',handle_scroll); 525 if(document && document.addEventListener){ 526 527 document.removeEventListener("touchmove", handle_mousemove, false); 528 } 529 } 530 function debug_func(){ 531 //console.info(debug_var); 532 debug_var = true; 533 } 534 function destroy_listeners(){ 535 536 //console.info('DESTROY LISTENERS'); 537 538 clearInterval(inter_debug_func); 539 clearInterval(inter_recheck_dims); 540 sw_stop_enter_frame = true; 541 } 542 543 function handle_resize(e, pargs){ 544 cw=cthis.width(); 545 ww = window.innerWidth; 546 wh = window.innerHeight; 547 548 var margs = { 549 'call_from': 'event' 550 }; 551 552 if(pargs){ 553 margs = $.extend(margs,pargs); 554 } 555 556 557 if(started===false){ 558 return; 559 } 560 561 562 if(o.settings_mode=='oneelement'){ 563 var last_translate = cthis.css('transform');
564 cthis.css('transform','translate3d(0,0,0)'); 565 } 566 567 568 cthis_ot = parseInt(cthis.offset().top,10); 569 570 571 if(margs.call_from=='autocheck'){ 572 if(Math.abs(last_wh-wh)<4 && Math.abs(last_cthis_ot-cthis_ot)<4){ 573 if(o.settings_mode=='oneelement') { 574 cthis.css('transform', last_translate); 575 } 576 return false; 577 } 578 } 579 // console.warn('handle_resize', last_wh, wh, st, last_cthis_ot, cthis_ot, margs); 580 last_wh = wh; 581 last_cthis_ot = cthis_ot; 582 583 584 585 586 // console.info(cthis_ot, cthis); 587 588 //console.warn(responsive_reference_width, responsive_optimal_height); 589 590 if(responsive_reference_width && responsive_optimal_height){ 591 if(cw<responsive_reference_width){ 592 var aux = cw/responsive_reference_width*responsive_optimal_height; 593 //console.log(aux); 594 595 cthis.height(aux); 596 }else{ 597 598 cthis.height(responsive_optimal_height); 599 } 600 } 601 602 if(cw<760){ 603 cthis.addClass('under-760') 604 }else{ 605 606 cthis.removeClass('under-760') 607 } 608 if(cw<500){ 609 cthis.addClass('under-500') 610 }else{ 611 612 cthis.removeClass('under-500') 613 } 614 615 if(int_calculate_dims){ 616 clearTimeout(int_calculate_dims); 617 } 618 619 int_calculate_dims = setTimeout(calculate_dims,700); 620 621 622 if(o.js_breakout=='on'){ 623 cthis.css('width',ww+'px'); 624 625 cthis.css('margin-left','0'); 626 627 //console.info(cthis, cthis.get(0).offsetLeft, cthis.offset().left, _theTarget.offset().left) 628 629 if(cthis.offset().left>0){ 630 cthis.css('margin-left','-'+cthis.offset().left+'px'); 631 } 632 } 633 634 if(o.is_fullscreen=='on'){ 635 //console.log(_theTarget,_theTarget.height(), target_viy, ch, th, wh); 636 637 // -- trying to fix damage .. 638 //if(th + target_viy < wh){ 639 // target_viy = wh-th; 640 // vi_y = wh-th; 641 // //console.info('WHAT HERE', duration_viy, vi_y); 642 // if(duration_viy>0){ 643 // 644 // backup_duration_viy = duration_viy; 645 // } 646 // duration_viy = 0; 647 // //console.log('yesyes', _theTarget,th, target_viy, ch, th, wh); 648 // handle_scroll(null, {force_vi_y : vi_y}); 649 // setTimeout(function(){ 650 // //console.info('WHAT', backup_duration_viy); 651 // duration_viy = backup_duration_viy; 652 // },50) 653 // //console.info(target_viy, th-_theTarget.height()) 654 //} 655 } 656 } 657 658 function calculate_dims(){ 659 660 //console.info(_theTarget); 661 ch = cthis.outerHeight(); 662 th = _theTarget.outerHeight(); 663 wh = window.innerHeight; 664 665 if(o.settings_substract_from_th){ 666 th-= o.settings_substract_from_th; 667 } 668 669 if(o.settings_clip_height_is_window_height){ 670 ch = window.innerHeight; 671 } 672 673 674 675 676 //return; 677 678 //console.info(initialheight); 679 if(cthis.hasClass('allbody')==false && cthis.hasClass('dzsparallaxer---window-height')==false && responsive_reference_width==0){ 680 681 // console.info("hier"); 682 if(th<=initialheight && th > 0){ 683 if(o.settings_mode!='oneelement' && cthis.hasClass('do-not-set-js-height')==false && cthis.hasClass('height-is-based-on-content')==false) { 684 cthis.height(th); 685 } 686 ch = cthis.height(); 687 //_theTarget.css('top',0); 688 689 690 691 if(is_ie()&&version_ie()<=10){ 692 693 _theTarget.css('top','0'); 694 }else{ 695 696 _theTarget.css('transform','translate3d(0,'+0+'px,0)'); 697 } 698 699 if(_blackOverlay){ 700 _blackOverlay.css('opacity','0'); 701 } 702 }else{ 703 704 //console.log(cthis, 'why do we do this ? '); 705 706 // console.info(cthis.hasClass('do-not-set-js-height')); 707 if(o.settings_mode!='oneelement' && cthis.hasClass('do-not-set-js-height')==false && cthis.hasClass('height-is-based-on-content')==false){ 708 709 cthis.height(initialheight); 710 } 711 712 } 713 } 714 if(_theTarget.attr('data-forcewidth_ratio')){ 715 _theTarget.width(Number(_theTarget.attr('data-forcewidth_ratio')) * _theTarget.height()); 716 if(_theTarget.width()<cthis.width()){ 717 _theTarget.width(cthis.width()); 718 } 719 } 720 721 clearTimeout(inter_scroll_from_resize); 722 inter_scroll_from_resize = setTimeout(handle_scroll,200); 723 // setTimeout(function(){ 724 // 725 // }, 300); 726 727 } 728 729 //console.info(th, ch); 730 731 function handle_mousemove(e){ 732 733 734 if(o.settings_mode == 'mouse_body' ){ 735 st = e.pageY; 736 737 var vi_y = 0; 738 739 if(th==0){ 740 return; 741 } 742 743 vi_y = st/wh * (ch-th); 744
745 bo_o = st/ch; 746 747 //console.info(ch,th); 748 749 if(vi_y > 0){ vi_y = 0 }; 750 if(vi_y < ch-th){ vi_y = ch-th }; 751 if(bo_o > 1){ bo_o = 1 }; 752 if(bo_o < 0){ bo_o = 0 }; 753 754 finish_viy = vi_y; 755 756 757 //_theTarget.css('transform','translate3d(0,'+vi_y+'px,0)'); 758 } 759 760 761 if( o.settings_movexaftermouse=='on'){ 762 var mx = e.pageX; 763 764 765 var vi_x = 0; 766 767 768 vi_x = (mx/ww) * (cw-tw); 769 770 771 if(vi_x > 0){ vi_x = 0 }; 772 if(vi_x < cw-tw){ vi_x = cw-tw }; 773 774 775 finish_vix = vi_x; 776 777 778 //console.info(mx, ww, cw, tw, vi_x); 779 780 } 781 782 } 783 784 function handle_scroll(e, pargs){ 785 //console.info('handle_scroll', cthis, e, $(window).scrollTop()); 786 st = $(window).scrollTop(); 787 vi_y = 0; 788 789 790 791 792 // console.info(st,cthis_ot-cthis.outerHeight(), st, cthis_ot+cthis.outerHeight() ); 793 if( (cthis_ot > st-wh && st<cthis_ot+cthis.outerHeight()) || o.mode_scroll=='fromtop'){ 794 795 796 sw_out_of_display = false; 797 sw_suspend_functional = false;
798 }else{ 799 800 801 802 803 804 if(o.settings_detect_out_of_screen){ 805 sw_out_of_display = true; 806 sw_suspend_functional = true; 807 } 808 } 809 810 811 if(_scrollTop_is_another_element_top){ 812 st = -parseInt(_scrollTop_is_another_element_top.css('top'),10); 813 //console.info('handle_scroll', cthis, e, _scrollTop_is_another_element_top, _scrollTop_is_another_element_top.css('top'), st); 814 if(_scrollTop_is_another_element_top.data('targettop')){ 815 st = -_scrollTop_is_another_element_top.data('targettop'); 816 } 817 818 } 819 820 //console.info('scroll top is - ',st, o.settings_listen_to_object_scroll_top, _scrollTop_is_another_element_top.css('top'),'target top->',_scrollTop_is_another_element_top.data('targettop')); 821 822 823 if(o.settings_listen_to_object_scroll_top){ 824 st = o.settings_listen_to_object_scroll_top.val; 825 } 826 827 828 if(isNaN(st)){ 829 st = 0; 830 } 831 832 if(e){ 833 if(o.init_functional_remove_delay_on_scroll=='on'){ 834 //console.info("REMOVE SUSPEND FUNCTIONAL !!! ", cthis, sw_suspend_functional, e); 835 sw_suspend_functional = false;
836 } 837 } 838 839 var margs = { 840 force_vi_y: null 841 ,from: '' 842 ,force_ch: null 843 ,force_th: null 844 }; 845 846 847 848 if(pargs){ 849 margs = $.extend(margs,pargs); 850 } 851 852 853 if(o.settings_clip_height_is_window_height){ 854 ch = window.innerHeight; 855 } 856 857 //console.info('ch pre force_ch',ch); 858 if(margs.force_ch!=null){ 859 ch = margs.force_ch; 860 } 861 if(margs.force_th!=null){ 862 th = margs.force_th; 863 } 864 865 //console.info('ch post force_ch',ch); 866 867 868 //console.info(margs); 869 870 871 if(started===false){ 872 wh = window.innerHeight; 873 if((st+wh)>=cthis.offset().top){ 874 init_start(); 875 } 876 } 877 878 //console.info(th); 879 880 881 if(th==0){ 882 return; 883 } 884 885 886 //console.warn(st+wh, cthis_ot, started) 887 if(started===false || (o.settings_mode!='scroll' && o.settings_mode!='oneelement') ){ 888 return; 889 } 890 //console.warn(st+wh, cthis_ot, 'what') 891 892 if(o.settings_mode=='oneelement'){ 893 894 895 var aux_r = (st-cthis_ot+wh) / wh; 896 897 if(cthis.attr('id')=='debug') { 898 // console.info((st-cthis_ot+wh), st,cthis_ot, wh, aux_r); 899 } 900 901 if(aux_r<0){ 902 aux_r = 0; 903 } 904 if(aux_r>1){ 905 aux_r = 1; 906 } 907 908 909 if (o.direction == 'reverse') { 910 aux_r = Math.abs(1-aux_r); 911 } 912 913 vi_y = (aux_r * ( o.settings_mode_oneelement_max_offset*2) ) - o.settings_mode_oneelement_max_offset ; 914 915 finish_viy = vi_y; 916 //console.warn(st+wh, cthis_ot, aux_r) 917 918 919 if(cthis.attr('id')=='debug'){ 920 921 // console.info(vi_y); 922 } 923 924 } 925 926 927 if(o.settings_mode=='scroll') { 928 929 930 931 932 933 934 935 936 if (o.mode_scroll == 'fromtop') { 937 vi_y = ((st / ch)) * (ch - th); 938 939 if (o.is_fullscreen == 'on') { 940 941 vi_y = st / ($('body').height() - wh) * (ch - th); 942 943 944 if (_scrollTop_is_another_element_top) { 945 946 947 vi_y = st / (_scrollTop_is_another_element_top.height() - wh) * (ch - th); 948 949 } 950 } 951 952 if (o.direction == 'reverse') { 953 vi_y = (1 - (st / ch)) * (ch - th); 954 //console.info(st,th) 955 956 957 if (o.is_fullscreen == 'on') { 958 959 vi_y = (1 - (st / ($('body').height() - wh)) ) * (ch - th); 960 961 962 //console.info(_scrollTop_is_another_element_top); 963 if (_scrollTop_is_another_element_top) { 964 965 966 vi_y = (1 - (st / (_scrollTop_is_another_element_top.height() - wh)) ) * (ch - th); 967 968 //console.log(st,_scrollTop_is_another_element_top.height(),wh,ch,th, vi_y); 969 //vi_y = st / ( - wh) * (ch-th); 970 971 } 972 } 973 } 974 975 976 } 977 cthis_ot = cthis.offset().top; 978 979 980 if (_scrollTop_is_another_element_top) { 981 cthis_ot = -parseInt(_scrollTop_is_another_element_top.css('top'), 10); 982 } 983 984 //console.log(st, cthis_ot, wh, ch); 985 var auxer5 = (st - (cthis_ot - wh)) / ((cthis_ot + ch) - (cthis_ot - wh)); 986 987 988 //console.info('is fullscreen ?? - ', o.is_fullscreen); 989 if (o.is_fullscreen == 'on') { 990 991 992 993 //console.info('scrolltop - ',st); 994 995 auxer5 = st / ($('body').height() - wh); 996 997 //console.info($('body').height(), wh); 998 999 if (_scrollTop_is_another_element_top) { 1000 1001 1002 auxer5 = st / (_scrollTop_is_another_element_top.outerHeight() - wh); 1003 1004 //cthis_ot = -parseInt(_scrollTop_is_another_element_top.css('top'),10); 1005 } 1006 } 1007 1008 if (auxer5 > 1) { 1009 auxer5 = 1; 1010 } 1011 if (auxer5 < 0) { 1012 auxer5 = 0; 1013 } 1014 // console.info('st and auxer5 - ',st, auxer5, o.settings_listen_to_object_scroll_top); 1015 1016 if (animator_objects_arr) { 1017 1018 // console.info(animator_objects_arr); 1019 for (i = 0; i < animator_objects_arr.length; i++) { 1020 1021 var _c = animator_objects_arr[i]; 1022 var cdata = _c.data('parallax_options'); 1023 1024 1025 //console.info(cdata); 1026 if (cdata) { 1027 for (var j = 0; j < cdata.length; j++) { 1028 1029 if (auxer5 <= 0.5) { 1030 var auxer5_doubled = auxer5 * 2; 1031 var auxer5_doubled_inverse = (auxer5 * 2) - 1; 1032 if (auxer5_doubled_inverse < 0) { 1033 auxer5_doubled_inverse = -auxer5_doubled_inverse; 1034 } 1035 1036 //var auxval = cdata[j].initial + (auxer5*2) * cdata[j].mid; 1037 //if(cdata[j].initial > cdata[j].mid){ 1038 // auxval = (auxer5*2) * cdata[j].mid - cdata[j].initial; 1039 //} 1040 1041 var auxval = auxer5_doubled_inverse * cdata[j].initial + auxer5_doubled * cdata[j].mid; 1042 var cval = cdata[j].value; 1043 1044 cval = cval.replace('{{val}}', auxval); 1045 //console.log(cval); 1046 //console.info(cdata[j].property, auxval); 1047 _c.css(cdata[j].property, cval); 1048 } else { 1049 1050 var auxer5_doubled = (auxer5 - 0.5) * 2; 1051 var auxer5_doubled_inverse = auxer5_doubled - 1; 1052 if (auxer5_doubled_inverse < 0) { 1053 auxer5_doubled_inverse = -auxer5_doubled_inverse; 1054 } 1055 1056 //var auxval = cdata[j].initial + (auxer5*2) * cdata[j].mid; 1057 //if(cdata[j].initial > cdata[j].mid){ 1058 // auxval = (auxer5*2) * cdata[j].mid - cdata[j].initial; 1059 //} 1060 1061 var auxval = auxer5_doubled_inverse * cdata[j].mid + auxer5_doubled * cdata[j].final; 1062 1063 //console.info(auxval,auxer5_doubled_inverse,auxer5_doubled) 1064 var cval = cdata[j].value; 1065 cval = cval.replace('{{val}}', auxval); 1066 _c.css(cdata[j].property, cval); 1067 } 1068 } 1069 1070 } 1071 1072 1073 //console.info(animator_objects_arr[i],); 1074 } 1075 } 1076 1077 //console.info(auxer5, ch,th); 1078 1079 //console.info('pre calculate vi_y', auxer5, ch, th); 1080 if (o.mode_scroll == 'normal') { 1081 1082 1083 vi_y = auxer5 * (ch - th); 1084 //consoel.info(auxer5, vi_y); 1085 1086 if (o.direction == 'reverse') { 1087 1088 vi_y = (1 - (auxer5)) * (ch - th); 1089 } 1090 1091 // console.info(vi_y, auxer5, ch, th); 1092 1093 if (cthis.hasClass('debug-target')) { 1094 console.info(o.mode_scroll, st, cthis_ot, wh, ch, (cthis_ot + ch), auxer5); 1095 } 1096 1097 1098 } 1099 1100 1101 if(cthis.hasClass('simple-parallax')){ 1102 aux_r = (st+wh-cthis_ot) / (wh+th); 1103 1104 1105 // console.info('scroll top - ',st); 1106 // console.info('window height - ',wh); 1107 // console.info('cthis offset top - ',cthis_ot); 1108 // console.info('total height - ',th); 1109 1110 if(aux_r<0){ 1111 aux_r = 0; 1112 } 1113 if(aux_r>1){ 1114 aux_r = 1; 1115 } 1116 1117 aux_r = Math.abs(1-aux_r); 1118 1119 1120 // console.info(aux_r); 1121 1122 if(cthis.hasClass('is-mobile')){ 1123 simple_parallaxer_max_offset = cthis.height()/2; 1124 } 1125 1126 vi_y = (aux_r * ( simple_parallaxer_max_offset*2) ) - simple_parallaxer_max_offset ; 1127
1128 // console.warn(aux_r, vi_y); 1129 } 1130 1131 //console.info('calculate vi_y', vi_y); 1132 1133 if (_fadeouttarget) { 1134 1135 var auxer4 = Math.abs(((st - cthis_ot) / cthis.outerHeight()) - 1); 1136 if (auxer4 > 1) { 1137 auxer4 = 1; 1138 } 1139 if (auxer4 < 0) { 1140 auxer4 = 0; 1141 } 1142 1143 1144 _fadeouttarget.css('opacity', auxer4); 1145 } 1146 1147 1148 bo_o = st / ch; 1149 // console.info(st, vi_y,ch,th); 1150 1151 1152 if(cthis.hasClass('simple-parallax')==false){ 1153 if (vi_y > 0) { 1154 vi_y = 0 1155 } 1156 ; 1157 if (vi_y < ch - th) { 1158 vi_y = ch - th 1159 } 1160 ; 1161 1162 // console.info(vi_y); 1163 } 1164 1165 if (bo_o > 1) { 1166 bo_o = 1 1167 } 1168 ; 1169 if (bo_o < 0) { 1170 bo_o = 0 1171 } 1172 ; 1173 1174 //console.log(vi_y); 1175 1176 1177 if (margs.force_vi_y) { 1178 vi_y = margs.force_vi_y; 1179 } 1180 1181 finish_viy = vi_y; 1182 finish_bo = bo_o; 1183 1184 1185 // console.info(finish_viy); 1186 1187 // console.info('check ' , duration_viy); 1188 1189 if (duration_viy === 0) { 1190 1191 target_viy = finish_viy; 1192 1193 if (sw_suspend_functional == false || 0) { 1194 //console.info('DURATION VIY = 0', st, vi_y, target_viy) 1195 // if (is_ie() && version_ie() <= 10) { 1196 // _theTarget.css('top', '' + target_viy + 'px'); 1197 // } else { 1198 // 1199 // 1200 // _theTarget.css('transform', 'translate3d(0,' + target_viy + 'px,0)'); 1201 // } 1202 1203 1204 // console.info('check 2' , duration_viy); 1205 1206 1207 1208 if(cthis.hasClass('simple-parallax')){ 1209 1210 if(_theTarget.parent().hasClass('is-image') || cthis.hasClass('simple-parallax--is-only-image')){ 1211 //_theTarget.css('background-position-y',target_viy+'px') 1212 _theTarget.css('background-position-y','calc(50% - '+parseInt(target_viy,10)+'px)') 1213 } 1214 1215 }else{ 1216 if(is_ie()&&version_ie()<=10){ 1217 _theTarget.css('top',''+target_viy+'px'); 1218 }else{ 1219 _theTarget.css('transform','translate3d('+target_vix+'px,'+target_viy+'px,0)'); 1220 1221 1222 if(o.settings_mode=='oneelement'){ 1223 cthis.css('transform','translate3d('+target_vix+'px,'+target_viy+'px,0)'); 1224 } 1225 } 1226 } 1227 } 1228 1229 1230 } 1231 1232 //clearTimeout(inter_suspend_enter_frame); 1233 //if(sw_suspend_functional==false){ 1234 // inter_suspend_enter_frame = setTimeout(switch_suspend_enter_frame,700); 1235 //} 1236 //sw_suspend_functional = false;
1237 1238 } 1239 var time=0; 1240 //console.info(vi_y); 1241 1242 //console.info(st/ch, vi_y); 1243 //_theTarget.css('top',vi_y); 1244 //_theTarget.css('transform','translate3d(0,'+vi_y+'px,0)'); 1245 1246 } 1247 1248 function switch_suspend_enter_frame(){ 1249 sw_suspend_functional=true; 1250 } 1251 1252 function handle_frame(){ 1253 1254 1255 if(sw_suspend_functional){ 1256 requestAnimFrame(handle_frame); 1257 return false; 1258 } 1259 1260 //console.info('handle_frame', finish_viy, duration_viy, target_viy); 1261 //console.info('handle_frame()' , cthis); 1262 1263 if(isNaN(target_viy)){ 1264 target_viy=0; 1265 } 1266 1267 if(debug_var){ 1268 //console.log('animation running'); 1269 debug_var=false; 1270 } 1271 1272 1273 1274 //console.info(duration_viy); 1275 if(duration_viy===0){ 1276 if(api_outer_update_func){ 1277 api_outer_update_func(target_viy); 1278 } 1279 requestAnimFrame(handle_frame); 1280 return false; 1281 } 1282 1283 begin_viy = target_viy; 1284 change_viy = finish_viy - begin_viy; 1285 1286 begin_bo = target_bo; 1287 change_bo = finish_bo - begin_bo; 1288 1289 1290 //console.info(finish_viy, begin_viy, change_viy); 1291 //console.log(duration_viy); 1292 if(o.easing=='easeIn'){ 1293 target_viy = Number(Math.easeIn(1, begin_viy, change_viy, duration_viy).toFixed(5)); 1294 //target_viy = Number(Math.easeIn(1, begin_viy, change_viy, duration_viy)); 1295 target_bo = Number(Math.easeIn(1, begin_bo, change_bo, duration_viy).toFixed(5)); 1296 1297 // console.info(target_viy); 1298 } 1299 if(o.easing=='easeOutQuad'){ 1300 target_viy = Math.easeOutQuad(1, begin_viy, change_viy, duration_viy); 1301 target_bo = Math.easeOutQuad(1, begin_bo, change_bo, duration_viy); 1302 } 1303 if(o.easing=='easeInOutSine'){ 1304 target_viy = Math.easeInOutSine(1, begin_viy, change_viy, duration_viy); 1305 target_bo = Math.easeInOutSine(1, begin_bo, change_bo, duration_viy); 1306 } 1307 1308 1309 target_vix = 0; 1310 if(o.settings_movexaftermouse=='on'){ 1311 begin_vix = target_vix; 1312 change_vix = finish_vix - begin_vix; 1313 target_vix = Math.easeIn(1, begin_vix, change_vix, duration_viy); 1314 } 1315 1316 1317 //console.log(begin_viy, change_viy, target_viy); 1318 1319 // console.info('DURATION VIY = many', duration_viy, vi_y, target_viy) 1320 1321 if(cthis.hasClass('simple-parallax')){ 1322 1323 if(_theTarget.parent().hasClass('is-image')){ 1324 //_theTarget.css('background-position-y',target_viy+'px') 1325 _theTarget.css('background-position-y','calc(50% - '+parseInt(target_viy,10)+'px)') 1326 } 1327 1328 }else{ 1329 if(is_ie()&&version_ie()<=10){ 1330 _theTarget.css('top',''+target_viy+'px'); 1331 }else{ 1332 _theTarget.css('transform','translate3d('+target_vix+'px,'+target_viy+'px,0)'); 1333 1334 1335 if(o.settings_mode=='oneelement'){ 1336 cthis.css('transform','translate3d('+target_vix+'px,'+target_viy+'px,0)'); 1337 } 1338 } 1339 } 1340 1341 1342 1343 1344 //console.info(_blackOverlay,target_bo);; 1345 1346 if(_blackOverlay){ 1347 _blackOverlay.css('opacity',target_bo); 1348 } 1349 1350 if(api_outer_update_func){ 1351 api_outer_update_func(target_viy); 1352 } 1353 1354 if(stop_enter_frame){ 1355 return false;
1356 } 1357 1358 requestAnimFrame(handle_frame); 1359 } 1360 1361 }) 1362 } 1363 window.dzsprx_init = function(selector, settings) { 1364 if(typeof(settings)!="undefined" && typeof(settings.init_each)!="undefined" && settings.init_each==true ){ 1365 var element_count = 0; 1366 for (var e in settings) { element_count++; } 1367 if(element_count==1){ 1368 settings = undefined; 1369 } 1370 1371 $(selector).each(function(){ 1372 var _t = $(this); 1373 _t.dzsparallaxer(settings) 1374 }); 1375 }else{ 1376 $(selector).dzsparallaxer(settings); 1377 } 1378 1379 }; 1380})(jQuery); 1381 1382function is_mobile() { 1383 var userAgent = navigator.userAgent || navigator.vendor || window.opera; 1384 1385 // Windows Phone must come first because its UA also contains "Android" 1386 if (/windows phone/i.test(userAgent)) { 1387 return true; 1388 } 1389 1390 if (/android/i.test(userAgent)) { 1391 return true; 1392 } 1393 1394 // iOS detection from: http://stackoverflow.com/a/9039885/177710 1395 if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) { 1396 return true; 1397 } 1398 1399 return false; 1400} 1401 1402function is_touch_device() { 1403 return !!('ontouchstart' in window); 1404} 1405 1406window.requestAnimFrame = (function(){ 1407 return window.requestAnimationFrame || 1408 window.webkitRequestAnimationFrame || 1409 window.mozRequestAnimationFrame || 1410 function( callback ){ 1411 window.setTimeout(callback, 1000 / 60); 1412 }; 1413})(); 1414 1415 1416function is_ie() { 1417 var ua = window.navigator.userAgent; 1418 //console.info(ua); 1419 1420 var msie = ua.indexOf('MSIE '); 1421 if (msie > 0) { 1422 // IE 10 or older => return version number 1423 return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10); 1424 } 1425 1426 var trident = ua.indexOf('Trident/'); 1427 if (trident > 0) { 1428 // IE 11 => return version number 1429 var rv = ua.indexOf('rv:'); 1430 return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10); 1431 } 1432 1433 var edge = ua.indexOf('Edge/'); 1434 if (edge > 0) { 1435 // IE 12 => return version number 1436 return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10); 1437 } 1438 1439 // other browser 1440 return false; 1441} 1442; 1443 1444function is_ie11(){ 1445 return !(window.ActiveXObject) && "ActiveXObject" in window; 1446} 1447function version_ie() { 1448 return parseFloat(navigator.appVersion.split("MSIE")[1]); 1449} 1450; 1451 1452 1453jQuery(document).ready(function($){ 1454 1455 $('.dzsparallaxer---window-height').each(function(){ 1456 var _t = $(this); 1457 //return false; 1458 1459 $(window).on('resize',handle_resize); 1460 handle_resize(); 1461 1462 function handle_resize(){ 1463 var wh = window.innerHeight; 1464 1465 _t.height(wh); 1466 } 1467 }) 1468 dzsprx_init('.dzsparallaxer.auto-init', {init_each: true}); 1469 1470});
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.