1/*shortcode posts classic slider*/ 2;(function($){ 3 $(document).ready(function() { 4 function isNumber(n) {return !isNaN(parseFloat(n)) && isFinite(n);}; 5 /*Function create Carousel*/ 6 function __cactusCreateCarousel(elements, index, sliderArray, perview, position){ 7 var $this = elements; 8 var container = ''; 9 if(position=='1') { 10 container='.cactus-silder-sync-content'; 11 }else{ 12 container='.cactus-silder-sync-listing'; 13 }; 14 15 function checkWidthSlide(){ 16 var defaultWidth = $this.find(container).find('.swiper-slide > .sync-img-content').outerWidth(); 17 $this.find(container).find('.swiper-slide').width(defaultWidth); 18 }; 19 20 checkWidthSlide(); 21 22 function setHeightSlider() { 23 var intHeight = $this.find('.cactus-silder-sync-content').find('.swiper-slide:first-child > .sync-img-content').outerHeight(); 24 $('.cactus-swiper-container, .swiper-wrapper, .swiper-slide', $this.find('.cactus-silder-sync-content')).height(intHeight); 25 }; 26 setHeightSlider(); 27 var strDirection = $this.attr('data-layout'); 28 var intAutoPlay = $this.attr('data-autoplay'); 29 30 function createSlider(){ 31 32 sliderArray = $(container, $this).swiper({ 33 slidesPerView: perview, 34 loop: false, 35 calculateHeight:true, 36 speed:500, 37 simulateTouch:false, 38 direction: strDirection=='vertical'?'vertical':'horizontal', 39 roundLengths:true, 40 autoplayDisableOnInteraction:false, 41 autoHeight:true, 42 updateTranslate:true, 43 }); 44 45 if(position=='1') { 46 $cactusSwiperSyncPost[index]=sliderArray; 47 $this.find('.next-carousel').on('click', function(){ 48 sliderArray.stopAutoplay(); 49 if(sliderArray.activeIndex==(sliderArray.slides.length-1)){ 50 sliderArray.slideTo(0); 51 }else{ 52 sliderArray.slideNext(); 53 }; 54 }); 55 $this.find('.pre-carousel').on('click', function(){ 56 sliderArray.stopAutoplay(); 57 if(sliderArray.activeIndex==0){ 58 sliderArray.slideTo(sliderArray.slides.length-1); 59 }else{ 60 sliderArray.slidePrev(); 61 }; 62 }); 63 var checkAutoPlay = 0; 64 if(intAutoPlay!='' && intAutoPlay!=null && typeof(intAutoPlay)!='undefined' && isNumber(intAutoPlay) && intAutoPlay=='1') { 65 sliderArray.params.autoplay=5000; 66 sliderArray.startAutoplay(); 67 68 var funcSetTimeOut = null; 69 70 $this.on({ 71 mouseenter: function(){ 72 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 73 checkAutoPlay = 1; 74 sliderArray.stopAutoplay(); 75 }, 76 mouseleave: function(){ 77 checkAutoPlay = 0; 78 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 79 if(sliderArray.activeIndex == sliderArray.slides.length-1){ 80 sliderArray.stopAutoplay(); 81 funcSetTimeOut = setTimeout(function(){sliderArray.slideTo(0, 1000); sliderArray.startAutoplay();},5000); 82 }else{ 83 sliderArray.startAutoplay(); 84 }; 85 } 86 }); 87 88 sliderArray.params.onSlideChangeEnd = function(){ 89 if(checkAutoPlay == 0){ 90 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 91 if(sliderArray.activeIndex == sliderArray.slides.length-1){ 92 sliderArray.stopAutoplay(); 93 funcSetTimeOut = setTimeout(function(){if(checkAutoPlay==0){sliderArray.slideTo(0, 1000); sliderArray.startAutoplay();}},5000); 94 }; 95 }; 96 $this.on({ 97 mouseenter: function(){ 98 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 99 sliderArray.stopAutoplay(); 100 }, 101 mouseleave: function(){ 102 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 103 if(sliderArray.activeIndex == sliderArray.slides.length-1){ 104 sliderArray.stopAutoplay(); 105 funcSetTimeOut = setTimeout(function(){sliderArray.slideTo(0, 1000); sliderArray.startAutoplay();},5000); 106 }; 107 } 108 }); 109 }; 110 }; 111 }else{
112 $cactusSwiperSyncListing[index]=sliderArray; 113 }; 114 115 function resizeWidthSlide(){ 116 var dpr = window.devicePixelRatio; 117 if(typeof dpr =='undefined') { dpr = 1;}; 118 dpr = 1; 119 var width = window.innerWidth * dpr; 120 121 // sliderArray.appendSlide('<div class="swiper-slide"><div class="sync-img-content"></div></div>'); 122 123 if(position!='1') { 124 if (width >= 768){ 125 sliderArray.params.slidesPerView=perview; 126 }else if(width >= 480){ 127 sliderArray.params.slidesPerView=perview; 128 }else{ 129 sliderArray.params.slidesPerView=3; 130 }; 131 }else{ 132 // 133 }; 134 135 // sliderArray.removeLastSlide(); 136 137 sliderArray.update(); 138 sliderArray.onResize(); 139 }; 140 141 resizeWidthSlide(); 142 setTimeout(resizeWidthSlide,500); 143 144 var _df_width = $(window).width(); 145 $(window).on('resize', function(){ 146 if($(window).width()!=_df_width){ 147 $('.swiper-wrapper, .swiper-slide',$this.find(container)).removeAttr('style'); 148 $('.swiper-wrapper',$this.find('.cactus-silder-sync-content')).removeAttr('style'); 149 resizeWidthSlide(); 150 setHeightSlider(); 151 sliderArray.update(true); 152 sliderArray.slideTo(0); 153 _df_width = $(window).width(); 154 }; 155 }); 156 157 }; 158 createSlider(); 159 }; 160 /*Function create Carousel*/ 161 162 var $cactusSwiperSyncPost = []; 163 var $cactusSwiperSyncListing = []; 164 var $cactusSwiperSyncPostStart = []; 165 var $cactusSwiperSyncListingStart = []; 166 $('.cactus-slider-sync').each(function(index, element) { 167 var $this=$(this); 168 var intAutoPlayFc = $this.attr('data-autoplay'); 169 170 __cactusCreateCarousel($this, index, $cactusSwiperSyncPost[index], 1, '1'); 171 172 173 if($this.attr('data-layout')!='vertical') { 174 __cactusCreateCarousel($this, index, $cactusSwiperSyncListing[index], 5, '2'); 175 function addRemoveActive(index){ 176 $('.cactus-silder-sync-listing .swiper-slide', $this).removeClass('active'); 177 $('.cactus-silder-sync-listing .swiper-slide', $this).eq(index).addClass('active'); 178 }; 179 180 addRemoveActive(0); 181 182 $cactusSwiperSyncPostStart[index]=0; 183 $cactusSwiperSyncListingStart[index]=0; 184 185 $cactusSwiperSyncPost[index].params.onSlideChangeStart = function(){ 186 if($cactusSwiperSyncListingStart[index]==1) { 187 $cactusSwiperSyncListingStart[index]=0; 188 }else{ 189 $cactusSwiperSyncPostStart[index]=1; 190 $cactusSwiperSyncListing[index].slideTo($cactusSwiperSyncPost[index].activeIndex); 191 addRemoveActive($cactusSwiperSyncPost[index].activeIndex); 192 }; 193 }; 194 195 $cactusSwiperSyncListing[index].params.onSlideChangeStart = function(){ 196 if($cactusSwiperSyncPostStart[index]==1) { 197 $cactusSwiperSyncPostStart[index]=0; 198 }else{ 199 $cactusSwiperSyncListingStart[index]=1; 200 $cactusSwiperSyncPost[index].slideTo( $cactusSwiperSyncListing[index].activeIndex, 500, false); 201 addRemoveActive($cactusSwiperSyncListing[index].activeIndex); 202 }; 203 }; 204 205 var intSlidesLength = index; 206 $this.find('.vertical-align .swiper-slide').each(function(index, element) { 207 $(this).find('.thumb-overlay').on('click', function(){ 208 $cactusSwiperSyncPost[intSlidesLength].stopAutoplay(); 209 $cactusSwiperSyncPost[intSlidesLength].slideTo( index, 500, false); 210 $cactusSwiperSyncListing[intSlidesLength].slideTo( index, 500, false); 211 $this.find('.swiper-slide').removeClass('active'); 212 $(this).parents('.swiper-slide').addClass('active'); 213 return false; 214 }); 215 }); 216 }else{ 217 var intSlidesLength = index; 218 $this.find('.vertical-align .swiper-slide').each(function(index, element) { 219 $(this).on('click', function(){ 220 $cactusSwiperSyncPost[intSlidesLength].stopAutoplay(); 221 $cactusSwiperSyncPost[intSlidesLength].slideTo( index, 500, false); 222 $this.find('.swiper-slide').removeClass('active'); 223 $(this).addClass('active'); 224 return false; 225 });
226 }); 227 228 $cactusSwiperSyncPost[index].params.onSlideChangeStart = function(){ 229 $this.find('.vertical-align .swiper-slide').removeClass('active'); 230 $this.find('.vertical-align .swiper-slide').eq($cactusSwiperSyncPost[index].activeIndex).addClass('active'); 231 }; 232 233 var _df_width = $(window).width(); 234 $(window).on('resize', function(){ 235 if($(window).width()!=_df_width){ 236 $this.find('.vertical-align .swiper-slide').removeClass('active'); 237 $this.find('.vertical-align .swiper-slide').eq(0).addClass('active'); 238 _df_width = $(window).width(); 239 }; 240 }); 241 242 /*Fix ie9*/ 243 function getInternetExplorerVersion(){ 244 var rv = -1; 245 if (navigator.appName == 'Microsoft Internet Explorer'){ 246 var ua = navigator.userAgent; 247 var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); 248 if (re.exec(ua) != null){ 249 rv = parseFloat( RegExp.$1 ); 250 }; 251 }else if (navigator.appName == 'Netscape'){ 252 var ua = navigator.userAgent; 253 var re = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})"); 254 if (re.exec(ua) != null){ 255 rv = parseFloat( RegExp.$1 ); 256 }; 257 }; 258 return rv; 259 }; 260 function msieversion(){ 261 var ua = window.navigator.userAgent; 262 var msie = ua.indexOf ( "MSIE " ); 263 if ( msie > 0 ){ 264 return parseInt (ua.substring (msie+5, ua.indexOf (".", msie ))); 265 }else{ 266 return 0; 267 }; 268 }; 269 if(getInternetExplorerVersion()!=0 && getInternetExplorerVersion()!=-1) { 270 function fixHeightIE9() { 271 if(window.innerWidth>767){ 272 setTimeout(function(){ 273 $this.find('.cactus-silder-sync-listing').height($this.height()); 274 $this.find('.vertical-align .swiper-slide').height($this.height()/6); 275 },368); 276 }else{ 277 setTimeout(function(){ 278 $this.find('.cactus-silder-sync-listing').removeAttr('style'); 279 $this.find('.vertical-align .swiper-slide').removeAttr('style'); 280 },368); 281 }; 282 }; 283 fixHeightIE9(); 284 var __df_width = $(window).width(); 285 $(window).on('resize', function(){ 286 if($(window).width()!=__df_width){ 287 fixHeightIE9(); 288 __df_width = $(window).width(); 289 }; 290 }); 291 }; 292 /*Fix ie9*/ 293 }; 294 }); 295 296 $('.newstube_playlist.shortcode').each(function(){ 297 var index = $('.cactus-widget-posts-item.active', this).index($('.cactus-widget-posts-item', this)) + 1; 298 $('.total-video span', this).text(index + '/' + $(this).find('.cactus-widget-posts-item').length ); 299 }); 300 }); 301}(jQuery)); 302 303/*end shortcode posts classic slider*/ 304 305/*===================================================================================================================================================================================================*/ 306 307/*shortcode posts thumb slider*/ 308;(function($){ 309 $(document).ready(function() { 310 function isNumber(n) {return !isNaN(parseFloat(n)) && isFinite(n);}; 311 312 /*Function create Carousel*/ 313 function setVideoSlides(){ 314 $('[data-type="bg-video"]').each(function(index, element) { 315 var $this = $(this); 316 var strVideoSource = $this.attr('data-video-source'); 317 if(strVideoSource!='' && strVideoSource!=null && typeof(strVideoSource)!='undefined') { 318 319 var videoString = '<video width="auto" height="100%" id="video-banner-'+index+'" preload="auto" loop>'+ 320 '<source src="'+strVideoSource+'" type="video/mp4">'+ 321 '</video>'; 322 $(videoString).prependTo( $this ); 323 } 324 }); 325 }; 326 327 setVideoSlides(); 328 329 function __cactusCreateCarousel(elements, index, sliderArray, perview, position){ 330 var $this = elements; 331 $this.attr('id', 'cactus-thumb-slider-'+index); 332 var intAutoPlay = $this.attr('data-autoplay'); 333 var container = ''; 334 if(position=='1') { 335 container='.cactus-thumb-slider-container'; 336 }else{ 337 container='.cactus-thumb-slider-listing'; 338 }; 339 340 function checkHeightSlide(){ 341 if(position=='1') { 342 $('#cactus-thumb-slider-style-'+index).remove(); 343 $this.find(container).find('.swiper-slide').height($this.height()); 344 $('<style type="text/css" id="cactus-thumb-slider-style-'+index+'">#cactus-thumb-slider-'+index+' '+container+' .swiper-slide{ height:'+$this.height()+'px}</style>').appendTo('head'); 345 }; 346 }; 347 checkHeightSlide(); 348 349 function createSlider(){ 350 351 sliderArray = $(container, $this).swiper({ 352 slidesPerView: perview, 353 loop: false, 354 calculateHeight:true, 355 speed:200, 356 simulateTouch:false, 357 progress:position=='1'?true:false, 358 effect: position=='1'?'fade':'slide', 359 // slideToClickedSlide:true, 360 // onClick: function(swiper,event){ 361 // swiper.slideNext(); 362 // }, 363 // onProgressChange: function(swiper){ 364 // if(position=='1') { 365 // for (var i = 0; i < swiper.slides.length; i++){ 366 // var slide = swiper.slides[i];
367 // var progress = slide.progress; 368 // var translate = progress*swiper.width; 369 // var opacity = 1 - Math.min(Math.abs(progress),1); 370 // slide.style.opacity = opacity; 371 // swiper.setTransform(slide,'translate3d('+translate+'px,0,0)'); 372 // }; 373 // }; 374 // }, 375 // onTouchStart:function(swiper){ 376 // if(position=='1') { 377 // for (var i = 0; i < swiper.slides.length; i++){ 378 // swiper.setTransition(swiper.slides[i], 0); 379 // }; 380 // }; 381 // }, 382 // onSetWrapperTransition: function(swiper, speed) { 383 // if(position=='1') { 384 // for (var i = 0; i < swiper.slides.length; i++){ 385 // swiper.setTransition(swiper.slides[i], speed); 386 // }; 387 // }; 388 // }, 389 390 autoplayDisableOnInteraction:false, 391 }); 392 if(position=='1') { 393 $cactusSwiperSyncPost[index]=sliderArray; 394 $this.find('.next-carousel').on('click', function(){ 395 if(sliderArray.activeIndex==(sliderArray.slides.length-1)){ 396 sliderArray.slideTo(0); 397 }else{ 398 sliderArray.slideNext(); 399 }; 400 }); 401 $this.find('.pre-carousel').on('click', function(){ 402 if(sliderArray.activeIndex==0){ 403 sliderArray.slideTo(sliderArray.slides.length-1); 404 }else{ 405 sliderArray.slidePrev(); 406 }; 407 }); 408 var checkAutoPlay = 0; 409 410 if(intAutoPlay!='' && intAutoPlay!=null && typeof(intAutoPlay)!='undefined' && isNumber(intAutoPlay) && intAutoPlay=='1') { 411 sliderArray.params.autoplay=5000; 412 sliderArray.startAutoplay(); 413 414 var funcSetTimeOut = null; 415 416 $this.on({ 417 mouseenter: function(){ 418 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 419 checkAutoPlay = 1; 420 sliderArray.stopAutoplay(); 421 }, 422 mouseleave: function(){ 423 checkAutoPlay = 0; 424 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 425 if(sliderArray.activeIndex == sliderArray.slides.length-1){ 426 sliderArray.stopAutoplay(); 427 funcSetTimeOut = setTimeout(function(){sliderArray.slideTo(0, 1000); sliderArray.startAutoplay();},5000); 428 }else{ 429 sliderArray.startAutoplay(); 430 }; 431 } 432 }); 433 434 sliderArray.params.onSlideChangeEnd = function(){ 435 if(checkAutoPlay == 0){ 436 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 437 if(sliderArray.activeIndex == sliderArray.slides.length-1){ 438 sliderArray.stopAutoplay(); 439 funcSetTimeOut = setTimeout(function(){if(checkAutoPlay==0){sliderArray.slideTo(0, 1000); sliderArray.startAutoplay();}},5000); 440 }; 441 }; 442 $this.on({ 443 mouseenter: function(){ 444 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 445 sliderArray.stopAutoplay(); 446 }, 447 mouseleave: function(){ 448 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 449 if(sliderArray.activeIndex == sliderArray.slides.length-1){ 450 sliderArray.stopAutoplay(); 451 funcSetTimeOut = setTimeout(function(){sliderArray.slideTo(0, 1000); sliderArray.startAutoplay();},5000); 452 }; 453 } 454 }); 455 }; 456 }; 457 }else{ 458 $cactusSwiperSyncListing[index]=sliderArray; 459 }; 460 461 function resizeWidthSlide(){ 462 checkHeightSlide(); 463 var dpr = window.devicePixelRatio; 464 if(typeof dpr =='undefined') { dpr = 1;}; 465 dpr = 1; 466 var width = window.innerWidth * dpr; 467 468 if(position!='1') { 469 var newWidthItem = Math.round($(container, $this).outerWidth() / 5 * 2); 470 sliderArray.appendSlide('<div class="sync-img-content"></div>'); 471 if (width >= 1200){ 472 sliderArray.params.slidesPerView=perview; 473 }else if(width >= 992){ 474 newWidthItem = Math.round($(container, $this).outerWidth() / 10.5 * 3); 475 $(container+' .swiper-slide', $this).width(newWidthItem); 476 sliderArray.params.slidesPerView='auto'; 477 }else if(width >= 768){ 478 newWidthItem = Math.round($(container, $this).outerWidth() / 5 * 2); 479 $(container+' .swiper-slide', $this).width(newWidthItem); 480 sliderArray.params.slidesPerView='auto'; 481 }else if(width >= 580){ 482 newWidthItem = Math.round($(container, $this).outerWidth() / 5 * 2); 483 $(container+' .swiper-slide', $this).width(newWidthItem); 484 sliderArray.params.slidesPerView='auto'; 485 }else{ 486 newWidthItem = Math.round($(container, $this).outerWidth() / 3 * 2); 487 $(container+' .swiper-slide', $this).width(newWidthItem); 488 sliderArray.params.slidesPerView='auto'; 489 }; 490 // sliderArray.removeLastSlide(); 491 }else{ 492 // for(var k=0; k < sliderArray.slides.length; k++){ 493 // sliderArray.setTransition(sliderArray.slides[k], 0); 494 // }; 495 // $(container+' > .swiper-wrapper', $this).stop(true,true).css('transition-duration','0s'); 496 }; 497 sliderArray.update(); 498 sliderArray.onResize();; 499 500 if(sliderArray.activeIndex>0) { 501 sliderArray.slideTo(0); 502 }; 503 }; 504 505 resizeWidthSlide(); 506 setTimeout(function(){ 507 resizeWidthSlide(); 508 if(position!='1') { 509 $(container+' .swiper-slide', $this).addClass('show-now'); 510 }; 511 },368); 512 513 var _df_width = $(window).width(); 514 $(window).on('resize', function(){ 515 if($(window).width()!=_df_width){ 516 resizeWidthSlide(); 517 setTimeout(function(){ 518 resizeWidthSlide(); 519 },368); 520 _df_width = $(window).width(); 521 }; 522 }); 523 524 }; 525 526 createSlider(); 527 }; 528 /*Function create Carousel*/ 529
530 var $cactusSwiperSyncPost = []; 531 var $cactusSwiperSyncListing = []; 532 var $cactusSwiperSyncPostStart = []; 533 var $cactusSwiperSyncListingStart = []; 534 $('.cactus-thumb-slider').each(function(index, element) { 535 var $this=$(this); 536 var topIndex = index; 537 $this.find('.cactus-thumb-slider-listing .thumb-item').each(function(index, element) { 538 var itemId = 'set-color-'+topIndex+'-'+index; 539 $(this).attr('id', itemId); 540 var attrColorStyle = $(this).attr('data-tag-color'); 541 if(attrColorStyle!='' && attrColorStyle!=null && typeof(attrColorStyle)!='undefined') { 542 $(topIndex+' .bottom-absolute').css({}); 543 $( 544 '<style>#'+itemId+' .bottom-absolute {background-color:'+attrColorStyle+';}#'+itemId+'.thumb-item:hover, .swiper-slide.active #'+itemId+'.thumb-item {background-color:'+attrColorStyle+';}#'+itemId+'.thumb-item:hover *:not(.cactus-note-cat), .swiper-slide.active #'+itemId+'.thumb-item *:not(.cactus-note-cat) {color:#FFFFFF;}#'+itemId+'.thumb-item .cactus-note-cat {background-color:'+attrColorStyle+'; color:#FFFFFF; transition:all 0.2s; -webkit-transition:all 0.2s;}#'+itemId+'.thumb-item:hover .cactus-note-cat, .swiper-slide.active #'+itemId+'.thumb-item .cactus-note-cat {background-color:#FFFFFF; color:'+attrColorStyle+'}</style>' 545 ).appendTo('head'); 546 }; 547 }); 548 549 __cactusCreateCarousel($this, index, $cactusSwiperSyncListing[index], 4, '2'); 550 __cactusCreateCarousel($this, index, $cactusSwiperSyncPost[index], 1, '1'); 551 552 function addRemoveActive(index){ 553 $('.cactus-thumb-slider-listing .swiper-slide', $this).removeClass('active'); 554 $('.cactus-thumb-slider-listing .swiper-slide', $this).eq(index).addClass('active'); 555 }; 556 557 addRemoveActive(0); 558 559 $cactusSwiperSyncPostStart[index]=0; 560 $cactusSwiperSyncListingStart[index]=0; 561 562 function playVideoActive(){ 563 var activeVideo = $('.cactus-thumb-slider-container .swiper-slide.swiper-slide-active', $this).find('video'); 564 565 if(activeVideo.length > 0) { 566 var myVideoPlay = document.getElementById(activeVideo.attr('id')); 567 myVideoPlay.play(); 568 }; 569 }; 570 571 $cactusSwiperSyncPost[index].params.onInit = function(){ 572 playVideoActive(); 573 }; 574 575 $cactusSwiperSyncPost[index].params.onSlideChangeStart = function(){ 576 if($cactusSwiperSyncListingStart[index]==1) { 577 $cactusSwiperSyncListingStart[index]=0; 578 }else{ 579 $cactusSwiperSyncPostStart[index]=1; 580 $cactusSwiperSyncListing[index].slideTo($cactusSwiperSyncPost[index].activeIndex); 581 addRemoveActive($cactusSwiperSyncPost[index].activeIndex); 582 }; 583 584 $('video', $this).each(function(index, element) { 585 var myVideoPlay = document.getElementById($(this).attr('id')); 586 myVideoPlay.pause(); 587 myVideoPlay.currentTime = 0; 588 }); 589 playVideoActive(); 590 }; 591 592 $cactusSwiperSyncListing[index].params.onSlideChangeStart = function(){ 593 if($cactusSwiperSyncPostStart[index]==1) { 594 $cactusSwiperSyncPostStart[index]=0; 595 }else{ 596 $cactusSwiperSyncListingStart[index]=1; 597 $cactusSwiperSyncPost[index].slideTo( $cactusSwiperSyncListing[index].activeIndex, 500, false); 598 addRemoveActive($cactusSwiperSyncListing[index].activeIndex); 599 }; 600 }; 601 602 var intSlidesLength = index; 603 604 $this.find('.slider-thumb .cactus-thumb-slider-listing .swiper-slide').each(function(index, element) { 605 606 $(this).find('.thumb-absolute-table').on('click', function(){ 607 $cactusSwiperSyncPost[intSlidesLength].stopAutoplay(); 608 $cactusSwiperSyncPost[intSlidesLength].slideTo( index, 500, false); 609 $cactusSwiperSyncListing[intSlidesLength].slideTo( index, 500, false); 610 $this.find('.swiper-slide').removeClass('active'); 611 $(this).parents('.swiper-slide').addClass('active'); 612 613 }); 614 }); 615 616 $cactusSwiperSyncListing[index].params.onClick = function(){ 617 618 }; 619 }); 620 621 }); 622}(jQuery)); 623/*end shortcode posts thumb slider*/ 624 625/*====================================================================================================================================================================================================*/ 626 627/*shortcode posts parallax*/ 628 629;(function($){ 630 function parallaxBanner(){ 631 (function($){ 632 $('.cactus-banner-parallax').each(function(index, element) { 633 var $this=$(this).find('.cactus-banner-parallax-content'); 634 var speed = 0.4; 635 var scrollPos = $(window).scrollTop()-$this.offset().top; 636 if($this.offset().top < window.innerHeight){ 637 speed = 0.6; 638 scrollPos = $(window).scrollTop(); 639 }; 640 if($(window).scrollTop() >= ($this.offset().top-window.innerHeight) && $(window).scrollTop()<($this.offset().top+window.innerHeight+$this.outerHeight())){ 641 $this.css({"background-position":"50% "+ -(scrollPos * speed) +"px"}); 642 }; 643 }); 644 }(jQuery)); 645 }; 646 647 $(document).ready(function() { 648 parallaxBanner(); 649 $(window).on("scroll", function() { 650 requestAnimationFrame(parallaxBanner); 651 }); 652 653 }); 654}(jQuery)); 655 656 657/*end shortcode posts parallax*/ 658 659/*====================================================================================================================================================================================================*/ 660 661/*shortcode posts grid*/ 662;(function($){ 663 $(document).ready(function() { 664 665 /*Slider*/ 666 function isNumber(n) {return !isNaN(parseFloat(n)) && isFinite(n);};
667 var $cactusSwiperPerView = []; 668 var iz= []; 669 var checkSetSlider = []; 670 $('.cactus-slider-wrap.slidesPerView').each(function(index, element) { 671 checkSetSlider[index] = 0; 672 var $this = $(this); 673 var intAutoPlay = $this.attr('data-auto-play'); 674 $cactusSwiperPerView[index] = $('.cactus-swiper-container', $this).swiper({ 675 slidesPerView: 'auto', 676 loop: false, 677 calculateHeight:true, 678 loopedSlides:($this.width() > 1140)?5:3, 679 speed:500, 680 autoplayDisableOnInteraction:false, 681 }); 682 $cactusSwiperPerView[index].update(); 683 $this.find('.cactus-slider-btn-next').on('click', function(){ 684 685 if($cactusSwiperPerView[index].activeIndex==($cactusSwiperPerView[index].slides.length-1) || ($this.offset().left+$this.width()+8 >= $this.find('.swiper-slide:last-child').offset().left+$this.find('.swiper-slide:last-child').width())){ 686 $cactusSwiperPerView[index].slideTo(0); 687 }else{ 688 $cactusSwiperPerView[index].slideNext(); 689 }; 690 }); 691 $this.find('.cactus-slider-btn-prev').on('click', function(){ 692 if($cactusSwiperPerView[index].activeIndex==0){ 693 $cactusSwiperPerView[index].slideTo($cactusSwiperPerView[index].slides.length-1); 694 }else{ 695 $cactusSwiperPerView[index].slidePrev(); 696 }; 697 }); 698 699 if(intAutoPlay!='' && intAutoPlay!=null && typeof(intAutoPlay)!='undefined' && isNumber(intAutoPlay)) { 700 $cactusSwiperPerView[index].params.autoplay=intAutoPlay; 701 $cactusSwiperPerView[index].startAutoplay(); 702 var checkAutoPlay = 0; 703 var funcSetTimeOut = null; 704 705 function _x_off(){ 706 if(($this.find('.swiper-slide:last-child').offset().left+$this.find('.swiper-slide:last-child').width()-4)<=($this.width()+$this.offset().left)) { 707 return true; 708 }else{ 709 return false; 710 }; 711 }; 712 713 $this.on({ 714 mouseenter: function(){ 715 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 716 checkAutoPlay = 1; 717 $cactusSwiperPerView[index].stopAutoplay(); 718 }, 719 mouseleave: function(){ 720 checkAutoPlay = 0; 721 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 722 if($this.find('.swiper-slide:last-child').hasClass('swiper-slide-visible') && _x_off()){ 723 $cactusSwiperPerView[index].stopAutoplay(); 724 funcSetTimeOut = setTimeout(function(){$cactusSwiperPerView[index].slideTo(0, 1000); $cactusSwiperPerView[index].startAutoplay();},5000); 725 }else{ 726 $cactusSwiperPerView[index].startAutoplay(); 727 }; 728 } 729 }); 730 731 $cactusSwiperPerView[index].params.onSlideChangeEnd = function(){ 732 if(checkAutoPlay == 0){ 733 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 734 if($this.find('.swiper-slide:last-child').hasClass('swiper-slide-visible') && _x_off()){ 735 $cactusSwiperPerView[index].stopAutoplay(); 736 funcSetTimeOut = setTimeout(function(){if(checkAutoPlay==0){$cactusSwiperPerView[index].slideTo(0, 1000); $cactusSwiperPerView[index].startAutoplay();}},5000); 737 }; 738 }; 739 740 741 $this.on({ 742 mouseenter: function(){ 743 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 744 $cactusSwiperPerView[index].stopAutoplay(); 745 }, 746 mouseleave: function(){ 747 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 748 if($this.find('.swiper-slide:last-child').hasClass('swiper-slide-visible') && _x_off()){ 749 $cactusSwiperPerView[index].stopAutoplay(); 750 funcSetTimeOut = setTimeout(function(){$cactusSwiperPerView[index].slideTo(0, 1000); $cactusSwiperPerView[index].startAutoplay();},5000); 751 }else{ 752 $cactusSwiperPerView[index].startAutoplay(); 753 }; 754 } 755 }); 756 }; 757 758 }; 759 760 function createMobileSlider(){ 761 var activeClassCheck = $('.swiper-slide:not(.swiper-slide-duplicate)', $this).find('.width-25percent:not(.add-mobile) .slide-post-item:nth-child(2)'); 762 var intLengthSlideAdd = activeClassCheck.length; 763 if(checkSetSlider[index]==0) { 764 // for(iz[index]=0;
764 iz[index] < intLengthSlideAdd; iz[index]++){ 765 // var htmlString = activeClassCheck.eq(iz[index]).html(); 766 // if($('.width-25percent.add-mobile.add-mobile-'+iz[index], $this).length==0 && htmlString!='' && htmlString!=null && typeof(htmlString)!='undefined'){ 767 // $cactusSwiperPerView[index].appendSlide('<div class="width-25percent add-mobile add-mobile-'+iz[index]+'"><div class="slide-post-item">'+activeClassCheck.eq(iz[index]).html()+'</div></div>'); 768 // $('.width-25percent.add-mobile.add-mobile-'+iz[index]).css('width', ($this.find('.cactus-swiper-container').width())+'px'); 769 // }; 770 // }; 771 $cactusSwiperPerView[index].update(); 772 $cactusSwiperPerView[index].onResize(); 773 checkSetSlider[index]=1; 774 }; 775 }; 776 777 function removeResponsiveSlide(){ 778 var intLengthSlideRemove = $this.find('.swiper-slide:not(.swiper-slide-duplicate) .width-25percent.add-mobile').length; 779 for(var k=0; k < intLengthSlideRemove; k++){ 780 // $cactusSwiperPerView[index].removeLastSlide(); 781 }; 782 $cactusSwiperPerView[index].update(); 783 $cactusSwiperPerView[index].onResize(); 784 checkSetSlider[index]=0; 785 }; 786 787 function calWidthResponsive(){ 788 var dpr = window.devicePixelRatio; 789 if(typeof dpr =='undefined') { dpr = 1;}; 790 dpr = 1; 791 var width = (window.innerWidth * dpr); 792 if(width < 768){ 793 $('.width-50percent, .width-25percent', $this).css('width', ($this.find('.cactus-swiper-container').width())+'px'); 794 $this.find('.cactus-swiper-container').css('max-height', $this.find('.width-50percent').height()); 795 $cactusSwiperPerView[index].params.loopedSlides=1; 796 createMobileSlider(); 797 }else{ 798 $('.width-50percent, .width-25percent', $this).css('width', ''); 799 $this.find('.cactus-swiper-container').css('max-height', ''); 800 ($this.width() > 1140)?$cactusSwiperPerView[index].params.loopedSlides=5:$cactusSwiperPerView[index].params.loopedSlides=3; 801 removeResponsiveSlide(); 802 }; 803 804 if($this.find('.swiper-slide.swiper-slide-visible').length == $cactusSwiperPerView[index].slides.length && $this.outerWidth()+8 >= $this.find('.swiper-wrapper').outerWidth()) { 805 $this.find('.cactus-slider-btn-next').hide(); 806 $this.find('.cactus-slider-btn-prev').hide(); 807 }else{ 808 $this.find('.cactus-slider-btn-next').show(); 809 $this.find('.cactus-slider-btn-prev').show(); 810 }; 811 }; 812 813 function FixResponsiveSlider(){ 814 calWidthResponsive(); 815 $cactusSwiperPerView[index].update(); 816 $cactusSwiperPerView[index].onResize(); 817 $cactusSwiperPerView[index].slideTo(0); 818 }; 819 820 FixResponsiveSlider(); 821 var _df_width = $(window).width(); 822 $(window).on('resize', function(){ 823 if($(window).width()!=_df_width){ 824 FixResponsiveSlider(); 825 _df_width = $(window).width(); 826 }; 827 }); 828 }); 829 /*Slider*/ 830 }); 831}(jQuery)) 832 833/*end shortcode posts grid*/ 834 835/*====================================================================================================================================================================================================*/ 836 837/*shortcode smart content box*/ 838 839;(function($){ 840 $.fn.cactus_smart_content_box = function(options){ 841 842 var $this=$(this); // Wrap 843 function isNumber(n) {return !isNaN(parseFloat(n)) && isFinite(n);}; 844 845 var sliderItemWrap = []; 846 $this.each(function(index, element) { 847 848 var $this_item = $(this); 849 var $this_category=$('.current-category > a.current-data', $this_item); 850 var urlGetData = $this_item.attr('data-ajax-server'); 851 var jsonGetData = $this_item.attr('data-json-server'); 852 var defaultFirstCategoryData = $this_category.attr('data-category-id'); 853 var smc_bg_color = $this_item.attr('data-bg-color'); 854 var smc_title_color = $this_item.attr('data-title-color'); 855 var smc_data_shortcode = $this_item.attr('data-shortcode'); 856 var smc_data_ids = $this_item.attr('data-ids'); 857 var smc_info_err = $this_item.attr('data-lang-err'); 858 859 if(smc_bg_color!='' && smc_bg_color!=null && typeof(smc_bg_color)!='undefined') { 860 //$('<style>.cactus-scb[data-bg-color="'+smc_bg_color+'"] .cactus-scb-title,.cactus-scb[data-bg-color="'+smc_bg_color+'"] .cactus-scb-title:before{background-color:'+smc_bg_color+'}</style>').appendTo('head'); 861 }; 862 863 if(smc_title_color!='' && smc_title_color!=null && typeof(smc_title_color)!='undefined') { 864 //$('<style>.cactus-scb[data-title-color="'+smc_title_color+'"] .cactus-scb-title {color:'+smc_title_color+'}</style>').appendTo('head'); 865 }; 866 867 if(smc_data_shortcode=='' || smc_data_shortcode==null || typeof(smc_data_shortcode)=='undefined') { 868 smc_data_shortcode=''; 869 }; 870 871 if(smc_data_ids=='' || smc_data_ids==null || typeof(smc_data_ids)=='undefined') { 872 smc_data_ids=''; 873 }; 874 875 var totalRecords, itemInPage, page, oddItem; 876 function reCalpage(intTotalRecords, intItemInPage) { 877 totalRecords = intTotalRecords; 878 if(!isNumber(totalRecords)) {totalRecords=0}; 879 totalRecords = parseInt(totalRecords);
880 881 itemInPage = intItemInPage; 882 if(!isNumber(itemInPage)) {itemInPage=0}; 883 itemInPage = parseInt(itemInPage); 884 885 page = 1; 886 887 if(totalRecords > itemInPage) { 888 oddItem = (totalRecords % itemInPage); 889 if(oddItem!=0){ 890 page=( (totalRecords-oddItem) / itemInPage ) + 1; 891 }else{ 892 page=(totalRecords / itemInPage ); 893 }; 894 }; 895 }; 896 897 reCalpage($this_item.attr('data-total-records'), $this_item.attr('data-item-in-page')); 898 899 function setHeightSlider() { 900 var intHeight = $('.swiper-slide.swiper-slide-active > .append-slide-auto > .cactus-listing-wrap', $this_item).height(); 901 $('.cactus-swiper-container, .swiper-wrapper, .swiper-slide, .append-slide-auto', $this_item).height(intHeight); 902 }; 903 904 var loading = '<div class="circularG-wrap">'+ 905 '<div class="circularG_1 circularG"></div>'+ 906 '<div class="circularG_2 circularG"></div>'+ 907 '<div class="circularG_3 circularG"></div>'+ 908 '<div class="circularG_4 circularG"></div>'+ 909 '<div class="circularG_5 circularG"></div>'+ 910 '<div class="circularG_6 circularG"></div>'+ 911 '<div class="circularG_7 circularG"></div>'+ 912 '<div class="circularG_8 circularG"></div>'+ 913 '</div>'; 914 915 var loading_1 = '<div class="floatingCirclesG">'+ 916 '<div class="f_circleG frotateG_01"></div>'+ 917 '<div class="f_circleG frotateG_02"></div>'+ 918 '<div class="f_circleG frotateG_03"></div>'+ 919 '<div class="f_circleG frotateG_04"></div>'+ 920 '<div class="f_circleG frotateG_05"></div>'+ 921 '<div class="f_circleG frotateG_06"></div>'+ 922 '<div class="f_circleG frotateG_07"></div>'+ 923 '<div class="f_circleG frotateG_08"></div>'+ 924 '</div>'; 925 926 function setNewSlide(mySwiper){ 927 var slideLength = (mySwiper.activeIndex+2); 928 929 if( (slideLength) > page) { 930 return -1; 931 }else{ 932 $('.pre-carousel', $this_item).removeClass('cactus-disable'); 933 if((slideLength) == page) { 934 $('.next-carousel', $this_item).addClass('cactus-disable'); 935 }; 936 if($('[data-page="'+slideLength+'"]', $this_item).length==0){ 937 938 var height = $('.swiper-slide.swiper-slide-active', $this_item).height(); 939 var newSlider = mySwiper.appendSlide('<div class="swiper-slide"><div class="append-slide-auto" data-page="'+slideLength+'" style="height:'+height+'px">'+loading+'</div></div>'); 940 // newSlider.append(); 941 return slideLength; 942 }else{ 943 return -1; 944 }; 945 }; 946 }; 947 948 sliderItemWrap[index] = $this_item.find('.cactus-swiper-container').height($this_item.find('.swiper-wrapper .append-slide-auto').height()).swiper({ // Kh?i t?o slider 949 loop: false, 950 simulateTouch:false, 951 swipeToNext:false, 952 speed:500, 953 onSwiperCreated:function(){ 954 setHeightSlider(); 955 setTimeout(setHeightSlider,368); 956 }, 957 onSlideChangeStart:function(){ 958 setHeightSlider(); 959 setTimeout(setHeightSlider,368); 960 if(sliderItemWrap[index].activeIndex==0){ 961 $('.pre-carousel', $this_item).addClass('cactus-disable'); 962 }; 963 }, 964 onSlideChangeEnd:function(){ 965 setHeightSlider(); 966 setTimeout(setHeightSlider,368); 967 }, 968 onInit:function(){ 969 setHeightSlider(); 970 setTimeout(setHeightSlider,368); 971 }, 972 }); 973 974 $this_item.find('.hidden-next-carousel').on('click', function(){sliderItemWrap[index].slideNext()}); 975 $('.pre-carousel', $this_item).on('click', function(){ 976 sliderItemWrap[index].slidePrev(); 977 $('.next-carousel', $this_item).removeClass('cactus-disable'); 978 }); 979 980 function loadAjaxPage(checkPageFillData, categoryData){ 981 if(urlGetData!='' && urlGetData!=null) { 982 var dataPostToServer_1 = {'category':categoryData, 'page':checkPageFillData, 'dataShortcode':smc_data_shortcode, 'ids':smc_data_ids, 'action':'cactusSCBdata'}; 983 $.ajax({
984 url: urlGetData, 985 type: 'POST', 986 data: dataPostToServer_1, 987 dataType: 'html', 988 success: function(data){ 989 if(data=='0' || data==''){ 990 sliderItemWrap[index].removeSlide(checkPageFillData-1); 991 setTimeout(function(){ 992 $this_item.attr('data-total-records', $('.cactus-post-item',$this_item).length); 993 reCalpage($('.cactus-post-item',$this_item).length, $this_item.attr('data-item-in-page')); 994 sliderItemWrap[index].slidePrev(); 995 },368); 996 }else{ 997 $('[data-page="'+checkPageFillData+'"]', $this_item).html(data+'<div class="effect-ajax"></div>'); 998 var intHeight = $('[data-page="'+checkPageFillData+'"] .append-slide-auto > .cactus-listing-wrap', $this_item).height(); 999 $('.cactus-swiper-container, .swiper-wrapper, .swiper-slide, .append-slide-auto', $this_item).height(intHeight); 1000 1001 var lazyLoadedImages = document.getElementsByClassName("adaptive"); 1002 for (var i = 0; i < lazyLoadedImages.length; i++) { 1003 loadAdaptiveImage(lazyLoadedImages[i]); 1004 }; 1005 1006 setHeightSlider(); 1007 setTimeout(function(){setHeightSlider;$('[data-page="'+checkPageFillData+'"] .effect-ajax', $this_item).addClass('hidden');},368); 1008 }; 1009 }, 1010 error: function(){ 1011 sliderItemWrap[index].removeSlide(checkPageFillData-1); 1012 setTimeout(function(){sliderItemWrap[index].slidePrev()},368); 1013 }, 1014 }); 1015 }; 1016 }; 1017 1018 function setDataAjax(){ 1019 var checkPageFillData=setNewSlide(sliderItemWrap[index]); 1020 $this_item.find('.hidden-next-carousel').trigger('click'); 1021 1022 if(checkPageFillData!= -1) { 1023 loadAjaxPage(checkPageFillData, $this_category.attr('data-category-id')); 1024 }; 1025 }; 1026 1027 $('.next-carousel', $this_item).on('click', function(){ 1028 setDataAjax(); 1029 }); 1030 1031 if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)) { 1032 $('.cactus-swiper-container', $this_item).swipe({ 1033 swipeLeft:function(event, direction, distance, duration, fingerCount, fingerData) { 1034 setDataAjax(); 1035 }, 1036 threshold:50, 1037 allowPageScroll:'vertical', 1038 fingers:'all', 1039 excludedElements: 'label, button, input, select, textarea, .noSwipe', 1040 }); 1041 }; 1042 1043 $('.current-category > a.current-data', $this_item).on('click', function(){ 1044 var $this_category = $(this); 1045 if($('.current-category', $this_item).hasClass('active')) { 1046 $('.current-category', $this_item).removeClass('active'); 1047 }else{ 1048 $('.current-category', $this_item).addClass('active'); 1049 }; 1050 }); 1051 1052 $('.current-category > .ajax-submenu > li > a.new-data', $this_item).on('click', function(){ 1053 var defaultMenuText = $this_category.text(); 1054 var defaultDataID = $this_category.attr('data-category-id'); 1055 1056 var newMenuText = $(this).text(); 1057 var newDataID = $(this).attr('data-category-id'); 1058 1059 $this_category.attr('data-category-id', newDataID); 1060 $(this).attr('data-category-id', defaultDataID); 1061 1062 $this_category.text(newMenuText); 1063 $(this).text(defaultMenuText); 1064 1065 $('.current-category', $this_item).removeClass('active'); 1066 1067 sliderItemWrap[index].removeAllSlides(); 1068 1069 if($this_item.find('.loading-new-page').length == 0) { $this_item.find('.swiper-wrapper').html('<div class="loading-new-page">'+loading+'</div>'); }; 1070 if($this_item.find('.loading-new-page-1').length == 0) { $this_item.append('<div class="loading-new-page-1">'+loading_1+'</div>'); }; 1071 $('.pre-carousel, .next-carousel', $this_item).removeClass('cactus-disable').hide(); 1072 1073 var dataPostToServer_2 = {'category':$this_category.attr('data-category-id'), 'dataShortcode':smc_data_shortcode, 'ids':smc_data_ids, 'action':'cactusSCBjson',}; 1074 $.ajax({
1075 url: jsonGetData, 1076 type: 'POST', 1077 data: dataPostToServer_2, 1078 dataType: 'json', 1079 cache: false, 1080 success: function(data){ 1081 if(data.totalRecords!='' && data.totalRecords!=null && typeof(data.totalRecords)!='undefined' && data.itemInPage!='' && data.itemInPage!=null && typeof(data.itemInPage)!='undefined') { 1082 1083 $this_item.attr('data-total-records', data.totalRecords); 1084 $this_item.attr('data-item-in-page', data.itemInPage); 1085 1086 reCalpage(data.totalRecords, data.itemInPage); 1087 1088 if(parseInt(data.totalRecords)!=0) { 1089 var dataPostToServer_3 = {'category':$this_category.attr('data-category-id'), 'page':'1', 'dataShortcode':smc_data_shortcode, 'ids':smc_data_ids, 'action':'cactusSCBdata'}; 1090 $.ajax({ 1091 url: urlGetData, 1092 type: 'POST', 1093 data: dataPostToServer_3, 1094 dataType: 'html', 1095 success: function(data){ 1096 if(data=='0' || data==''){ 1097 }else{ 1098 setTimeout(function(){ 1099 $this_item.find('.loading-new-page').remove(); 1100 $this_item.find('.loading-new-page-1').remove(); 1101 $('.pre-carousel, .next-carousel', $this_item).show(); 1102 1103 var newSlider = sliderItemWrap[index].createSlide('<div class="append-slide-auto" data-page="1">'+data+'<div class="effect-ajax"></div></div>'); 1104 newSlider.append(); 1105 1106 var intHeight = $('.append-slide-auto[data-page="1"] > .cactus-listing-wrap', $this_item).height(); 1107 $('.cactus-swiper-container, .swiper-wrapper, .swiper-slide, .append-slide-auto', $this_item).height(intHeight); 1108 $('[data-page="1"] .effect-ajax', $this_item).addClass('hidden'); 1109 1110 var lazyLoadedImages = document.getElementsByClassName("adaptive"); 1111 for (var i = 0; i < lazyLoadedImages.length; i++) { 1112 loadAdaptiveImage(lazyLoadedImages[i]); 1113 }; 1114 1115 setHeightSlider(); 1116 setTimeout(setHeightSlider,368); 1117 },368); 1118 }; 1119 }, 1120 error: function(){ 1121 }, 1122 }); 1123 1124 }else{ 1125 $this_item.find('.loading-new-page').remove(); 1126 $this_item.find('.loading-new-page-1').remove(); 1127 $('.cactus-swiper-container, .swiper-wrapper, .swiper-slide, .append-slide-auto', $this_item).height(30); 1128 }; 1129 1130 }else{ 1131 loadAjaxPage('1', defaultFirstCategoryData); 1132 }; 1133 }, 1134 error: function(){ 1135 loadAjaxPage('1', defaultFirstCategoryData); 1136 }, 1137 }); 1138 }); 1139 1140 var _df_width = $(window).width(); 1141 $(window).on('resize', function(){ 1142 if($(window).width()!=_df_width){ 1143 sliderItemWrap[index].update(); 1144 setHeightSlider(); 1145 setTimeout(setHeightSlider,368); 1146 _df_width = $(window).width(); 1147 }; 1148 }); 1149 1150 }); 1151 }; 1152 1153 $(document).ready(function() { 1154 $('.cactus-tab-content>div:first-child').each(function(index, el) { 1155 $(this).find('.cactus-scb').removeClass('no-tab-ajax-load'); 1156 }); 1157 $('.cactus-scb:not(.no-tab-ajax-load):not(.one-page-no-filter)').cactus_smart_content_box({}); 1158 }); 1159}(jQuery)); 1160/*end shortcode smart content box*/ 1161 1162/*====================================================================================================================================================================================================*/ 1163 1164/*shortcode posts slider*/ 1165 1166;(function($){ 1167 function parallaxBanner(){ 1168 (function($){ 1169 $('.cactus-banner-parallax-slider').each(function(index, element) { 1170 var $this=$(this).find('.cactus-banner-parallax-content'); 1171 var speed = 0.4; 1172 var scrollPos = $(window).scrollTop()-$this.offset().top; 1173 if($this.offset().top < window.innerHeight){ 1174 speed = 0.6; 1175 scrollPos = $(window).scrollTop(); 1176 }; 1177 if($(window).scrollTop() >= ($this.offset().top-window.innerHeight) && $(window).scrollTop()<($this.offset().top+window.innerHeight+$this.outerHeight())){ 1178 $this.css({"background-position":"50% "+ -(scrollPos * speed) +"px"}); 1179 }; 1180 }); 1181 }(jQuery)); 1182 }; 1183 $(document).ready(function() { 1184 function isNumber(n) {return !isNaN(parseFloat(n)) && isFinite(n);}; 1185 var cactusFaddingSlider = []; 1186 $('.cactus-banner-parallax-slider').each(function(index, element) { 1187 var $this = $(this); 1188 var intAutoPlay = $this.attr('data-autoplay'); 1189 $this.find('.pagination').attr('data-target', 'cbps-parallax-'+index); 1190 cactusFaddingSlider[index] = $('.cactus-swiper-container', $this).swiper({ 1191 slidesPerView: 1, 1192 loop: false, 1193 calculateHeight:true, 1194 speed:400, 1195 simulateTouch:true, 1196 grabCursor: false, 1197 roundLengths:true, 1198 watchSlidesProgress:true, 1199 effect: 'fade', 1200 // onProgress: function(swiper){ 1201 // for (var i = 0; i < swiper.slides.length; i++){ 1202 // var slide = swiper.slides[i];
1203 // var progress = slide.progress; 1204 // var translate = progress*swiper.width; 1205 // var opacity = 1 - Math.min(Math.abs(progress),1); 1206 // slide.style.opacity = opacity; 1207 // swiper.setTransform(slide,'translate3d('+translate+'px,0,0)'); 1208 // }; 1209 // }, 1210 // onTouchStart:function(swiper){ 1211 // for (var i = 0; i < swiper.slides.length; i++){ 1212 // swiper.setTransition(swiper.slides[i], 0); 1213 // }; 1214 // }, 1215 // onSetTransition: function(swiper, speed) { 1216 // for (var i = 0; i < swiper.slides.length; i++){ 1217 // swiper.setTransition(swiper.slides[i], speed); 1218 // }; 1219 // }, 1220 // onProgress: function(swiper, progress){ 1221 // for (var i = 0; i < swiper.slides.length; i++){ 1222 // var slide = swiper.slides[i]; 1223 // var progress = slide.progress; 1224 // var translate = progress * swiper.width; 1225 // var translate, opacity, bOpacity; 1226 // // var opacity = 1 - Math.min(Math.abs(progress),1) 1227 // if (progress > 0) { 1228 // translate; 1229 // // bOpacity = 0; 1230 // // opacity = 0; 1231 // } 1232 // else { 1233 // translate = 0; 1234 // // bOpacity = 1 - Math.min(Math.abs(progress),1); 1235 // // opacity ; 1236 // } 1237 // $(slide).css({ 1238 // // opacity: bOpacity, 1239 // transform: 'translate3d(' + 0 + 'px,0,0)' , 1240 // // opacity:opacity, 1241 // transition: 'opacity 600ms, translate3d 400ms' 1242 // }); 1243 // } 1244 // }, 1245 // onTouchStart: function(swiper){ 1246 // for (var i = 0; i < swiper.slides.length; i++){ 1247 // $(swiper.slides[i]).css({ transition: '' }); 1248 // } 1249 // }, 1250 // onSetTransition: function(swiper, speed) { 1251 // for (var i = 0; i < swiper.slides.length; i++){ 1252 // $(swiper.slides[i]).css({ transition: 'opacity '+600+'ms'+','+'translate3d ' + speed + 'ms' }); 1253 // } 1254 // }, 1255 paginationClickable: true, 1256 pagination: '.pagination[data-target="cbps-parallax-'+index+'"]', 1257 autoplayDisableOnInteraction:false, 1258 }); 1259 1260 cactusFaddingSlider[index].update(); 1261 if(intAutoPlay!='' && intAutoPlay!=null && typeof(intAutoPlay)!='undefined' && isNumber(intAutoPlay) && intAutoPlay=='1') { 1262 cactusFaddingSlider[index].params.autoplay=5000; 1263 cactusFaddingSlider[index].startAutoplay(); 1264 var checkAutoPlay = 0; 1265 var funcSetTimeOut = null; 1266 $this.on({ 1267 mouseenter: function(){ 1268 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 1269 checkAutoPlay = 1; 1270 cactusFaddingSlider[index].stopAutoplay(); 1271 }, 1272 mouseleave: function(){ 1273 checkAutoPlay = 0; 1274 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 1275 if(cactusFaddingSlider[index].activeIndex == cactusFaddingSlider[index].slides.length-1){ 1276 cactusFaddingSlider[index].stopAutoplay(); 1277 funcSetTimeOut = setTimeout(function(){cactusFaddingSlider[index].slideTo(0, 1000); cactusFaddingSlider[index].startAutoplay();},5000); 1278 }else{ 1279 cactusFaddingSlider[index].startAutoplay(); 1280 }; 1281 } 1282 }); 1283 1284 cactusFaddingSlider[index].params.onSlideChangeEnd = function(){ 1285 if(checkAutoPlay == 0){ 1286 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 1287 if(cactusFaddingSlider[index].activeIndex == cactusFaddingSlider[index].slides.length-1){ 1288 cactusFaddingSlider[index].stopAutoplay(); 1289 funcSetTimeOut = setTimeout(function(){if(checkAutoPlay==0){cactusFaddingSlider[index].slideTo(0, 1000); cactusFaddingSlider[index].startAutoplay();}},5000); 1290 }; 1291 }; 1292 $this.on({ 1293 mouseenter: function(){ 1294 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 1295 cactusFaddingSlider[index].stopAutoplay(); 1296 }, 1297 mouseleave: function(){ 1298 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 1299 if(cactusFaddingSlider[index].activeIndex == cactusFaddingSlider[index].slides.length-1){ 1300 cactusFaddingSlider[index].stopAutoplay(); 1301 funcSetTimeOut = setTimeout(function(){cactusFaddingSlider[index].slideTo(0, 1000); cactusFaddingSlider[index].startAutoplay();},5000); 1302 }else{ 1303 cactusFaddingSlider[index].startAutoplay(); 1304 }; 1305 } 1306 });
1307 }; 1308 1309 }; 1310 1311 // function fixFadingResize(e){ 1312 // $this.find('.swiper-container, .swiper-slide').css({'width':window.innerWidth+'px'}); 1313 1314 // for(var k=0; k < cactusFaddingSlider[index].slides.length; k++){ 1315 // cactusFaddingSlider[index].setTransition(cactusFaddingSlider[index].slides[k], 0); 1316 // }; 1317 // $('.swiper-wrapper', $this).stop(true,true).css('transition-duration','0s'); 1318 // cactusFaddingSlider[index].reInit(); 1319 // cactusFaddingSlider[index].resizeFix(); 1320 // if(cactusFaddingSlider[index].activeIndex>0) { 1321 // cactusFaddingSlider[index].swipeTo(0); 1322 // }; 1323 // }; 1324 1325 var _df_width = $(window).width(); 1326 $(window).on('resize', function() { 1327 if($(window).width()!=_df_width){ 1328 // fixFadingResize(); 1329 cactusFaddingSlider[index].onResize() 1330 // cactusFaddingSlider[index].slideTo(0); 1331 cactusFaddingSlider[index].update(); 1332 _df_width = $(window).width(); 1333 }; 1334 }); 1335 }); 1336 1337 }); 1338}(jQuery)); 1339 1340 1341/*end shortcode posts slider*/ 1342 1343/*====================================================================================================================================================================================================*/ 1344 1345/*shortcode posts carousel*/ 1346;(function($){ 1347 $(document).ready(function() { 1348 function createCarousel(options) { 1349 function isNumber(n) {return !isNaN(parseFloat(n)) && isFinite(n);}; 1350 var cactusCarousel = []; 1351 $('.cactus-carousel').each(function(index, element) { 1352 var $this = $(this); 1353 var parentsWidth = $this.parent().width(); 1354 var perview = 3; 1355 var intAutoPlay = $this.attr('data-autoplay'); 1356 var intVisibleItem = $this.attr('data-visible'); 1357 1358 function checkPerviewLoop() { 1359 if (parentsWidth >= 1890){ 1360 perview=6; 1361 }else if (parentsWidth >= 1550){ 1362 perview=5; 1363 }else if (parentsWidth >= 1200){ 1364 perview=4; 1365 }else if(parentsWidth >= 992){ 1366 if(intVisibleItem!='' && intVisibleItem!=null && typeof(intVisibleItem)!='undefined' && isNumber(intVisibleItem)){ 1367 perview=intVisibleItem; 1368 }else{ 1369 perview=3; 1370 }; 1371 }else if(parentsWidth >= 768){ 1372 perview=2; 1373 }else if(parentsWidth >= 580){ 1374 perview=2; 1375 }else{ 1376 perview=1; 1377 }; 1378 }; 1379 checkPerviewLoop(); 1380 1381 cactusCarousel[index] = $('.cactus-swiper-container', $this).swiper({ 1382 slidesPerView: perview, 1383 loop: false, 1384 calculateHeight:true, 1385 speed:600, 1386 simulateTouch:true, 1387 loopedSlides:perview, 1388 grabCursor: true, 1389 roundLengths:true, 1390 autoplayDisableOnInteraction:false, 1391 }); 1392 cactusCarousel[index].update(true); 1393 1394 $this.find('.next-carousel').on('click', function(){ 1395 if($this.offset().left+$this.width() >= $this.find('.swiper-slide:last-child').offset().left+$this.find('.swiper-slide:last-child').width()){ 1396 cactusCarousel[index].slideTo(0); 1397 }else{ 1398 cactusCarousel[index].slideNext(); 1399 }; 1400 }); 1401 $this.find('.pre-carousel').on('click', function(){ 1402 if(cactusCarousel[index].activeIndex==0){ 1403 cactusCarousel[index].slideTo(cactusCarousel[index].slides.length-1); 1404 }else{ 1405 cactusCarousel[index].slidePrev(); 1406 }; 1407 }); 1408 1409 if(intAutoPlay!='' && intAutoPlay!=null && typeof(intAutoPlay)!='undefined' && isNumber(intAutoPlay) && intAutoPlay=='1') { 1410 cactusCarousel[index].params.autoplay=5000; 1411 cactusCarousel[index].startAutoplay(); 1412 var checkAutoPlay = 0; 1413 var funcSetTimeOut = null; 1414 $this.on({ 1415 mouseenter: function(){ 1416 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 1417 checkAutoPlay = 1; 1418 cactusCarousel[index].stopAutoplay(); 1419 }, 1420 mouseleave: function(){ 1421 checkAutoPlay = 0; 1422 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 1423 if($this.find('.swiper-slide:last-child').hasClass('swiper-slide-visible')){ 1424 cactusCarousel[index].stopAutoplay(); 1425 funcSetTimeOut = setTimeout(function(){cactusCarousel[index].slideTo(0, 1000); cactusCarousel[index].startAutoplay();},5000); 1426 }else{ 1427 cactusCarousel[index].startAutoplay(); 1428 }; 1429 } 1430 });
1431 1432 cactusCarousel[index].params.onSlideChangeEnd = function(){ 1433 if(checkAutoPlay == 0){ 1434 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 1435 if($this.find('.swiper-slide:last-child').hasClass('swiper-slide-visible')){ 1436 cactusCarousel[index].stopAutoplay(); 1437 funcSetTimeOut = setTimeout(function(){if(checkAutoPlay==0){cactusCarousel[index].slideTo(0, 1000); cactusCarousel[index].startAutoplay();}},5000); 1438 1439 }; 1440 }; 1441 $this.on({ 1442 mouseenter: function(){ 1443 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 1444 cactusCarousel[index].stopAutoplay(); 1445 }, 1446 mouseleave: function(){ 1447 if(funcSetTimeOut!=null) {clearTimeout(funcSetTimeOut);}; 1448 if($this.find('.swiper-slide:last-child').hasClass('swiper-slide-visible')){ 1449 cactusCarousel[index].stopAutoplay(); 1450 funcSetTimeOut = setTimeout(function(){cactusCarousel[index].slideTo(0, 1000); cactusCarousel[index].startAutoplay();},5000); 1451 }else{ 1452 cactusCarousel[index].startAutoplay(); 1453 }; 1454 } 1455 }); 1456 }; 1457 1458 }; 1459 1460 function showHideNControl(){ 1461 if($this.find('.swiper-slide.swiper-slide-visible').length == cactusCarousel[index].slides.length) { 1462 $this.find('.next-carousel').hide(); 1463 $this.find('.pre-carousel').hide(); 1464 }else{ 1465 $this.find('.next-carousel').show(); 1466 $this.find('.pre-carousel').show(); 1467 }; 1468 }; 1469 1470 function calWidthResponsive(){ 1471 parentsWidth = $this.parent().width(); 1472 checkPerviewLoop(); 1473 // cactusCarousel[index].appendSlide('<div class="swiper-slide"><div class="carousel-item"></div></div>'); 1474 cactusCarousel[index].params.slidesPerView=perview; 1475 cactusCarousel[index].params.loopedSlides=perview; 1476 // cactusCarousel[index].removeLastSlide(); 1477 cactusCarousel[index].update(); 1478 cactusCarousel[index].onResize(); 1479 cactusCarousel[index].slideTo(0); 1480 showHideNControl(); 1481 }; 1482 1483 calWidthResponsive(); 1484 var _df_width = $(window).width(); 1485 $(window).on('resize', function(){ 1486 if($(window).width()!=_df_width){ 1487 calWidthResponsive(); 1488 _df_width = $(window).width(); 1489 }; 1490 }); 1491 1492 }); 1493 }; 1494 createCarousel({}); 1495 }); 1496}(jQuery)); 1497/*end shortcode posts carousel*/ 1498 1499/*====================================================================================================================================================================================================*/ 1500 1501/*tab smart*/ 1502;(function($){ 1503 1504 $('.cactus-tab-button > .sub-items:not(.show-on-mobile) > span:not(.not-button)').on('click', function(){ 1505 var $this = $(this); 1506 var $__group = $this.parents('.cactus-tab-button'); 1507 var $__parents = $this.parents('.cactus-tab'); 1508 var $__content = $('.cactus-tab-content > div', $__parents); 1509 1510 1511 if($this.hasClass('active')) {return false;} 1512 1513 $('.sub-items:not(.show-on-mobile)>span', $__group).removeClass('active'); 1514 $this.addClass('active'); 1515 $('.sub-items.show-on-mobile > .not-button', $__group).html($this.html()); 1516 1517 var $__active_id = $this.attr('data-active'); 1518 $__content.removeClass('active'); 1519 $('.cactus-tab-content > div[data-active="'+$__active_id+'"]', $__parents).addClass('active'); 1520 1521 if(!$('.cactus-tab-content > div[data-active="'+$__active_id+'"].active', $__parents).hasClass('check-smart-init')) { 1522 $('.cactus-tab-content > div[data-active="'+$__active_id+'"].active:not(.check-smart-init) .cactus-scb.no-tab-ajax-load:not(.one-page-no-filter)', $__parents).cactus_smart_content_box({}); 1523 $('.cactus-tab-content > div[data-active="'+$__active_id+'"].active:not(.check-smart-init)', $__parents).addClass('check-smart-init'); 1524 } 1525 1526 var intHeight = $('.cactus-tab-content > div[data-active="'+$__active_id+'"].active .cactus-scb:not(.one-page-no-filter) .swiper-slide-visible.swiper-slide-active > .append-slide-auto > .cactus-listing-wrap', $__parents).height(); 1527 1528 $('.cactus-tab-content > div[data-active="'+$__active_id+'"].active .cactus-scb:not(.one-page-no-filter) .cactus-swiper-container, .cactus-tab-content > div[data-active="'+$__active_id+'"].active .cactus-scb:not(.one-page-no-filter) .swiper-wrapper, .cactus-tab-content > div[data-active="'+$__active_id+'"].active .cactus-scb:not(.one-page-no-filter) .swiper-slide, .cactus-tab-content > div[data-active="'+$__active_id+'"].active .cactus-scb:not(.one-page-no-filter) .append-slide-auto', $__parents).height(intHeight); 1529 1530 $('.sub-items:not(.show-on-mobile)', $__group).removeClass('active'); 1531 }); 1532 1533 $('.cactus-tab-button > .sub-items.show-on-mobile > span.not-button').on('click', function(){ 1534 var $this = $(this); 1535 $this.parent('.sub-items').next('.sub-items:not(.show-on-mobile)').toggleClass('active'); 1536 }); 1537}(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.