1(function($) { 2$(window).load(function() { 3 4 //claculate proper width 5 function cis_calculate_width() { 6 $('.cis_images_holder').each(function() { 7 var $wrapper = $(this); 8 var total_w = 0; 9 $wrapper.find('.cis_row_item').each(function() { 10 $(this).find('img').css('width','auto'); 11 var w = parseInt($(this).find('img').width()); 12 $(this).find('img').width(w); 13 var m_r = isNaN(parseFloat($(this).css('margin-right'))) ? 0 : parseFloat($(this).css('margin-right')); 14 var m_l = isNaN(parseFloat($(this).css('margin-left'))) ? 0 : parseFloat($(this).css('margin-left')); 15 total_w += w + m_r*1 + m_l*1; 16 }); 17 total_w = total_w + 1*1; 18 $wrapper.width(total_w); 19 }); 20 }; 21 22 setTimeout(function() { 23 cis_calculate_width(); 24 },400); 25 setTimeout(function() { 26 cis_calculate_width(); 27 },1200); 28 29 30 //resize 31 $(window).resize(function() { 32 cis_calculate_width(); 33 }); 34 35 $(".cis_row_item img").each(function() { 36 var $cis_overlay = $(this).next('.cis_row_item_overlay'); 37 if($cis_overlay.attr('cis_animation') == 'enabled') 38 return; 39 $cis_overlay.css({'visibility' : 'hidden','display' : 'block'}); 40 var h = $cis_overlay.height(); 41 $cis_overlay.css({'visibility' : 'visible','display' : 'block','height' : '0'}).attr('h',h); 42 $cis_overlay.attr('cis_animation','enabled'); 43 }); 44 45 $(".cis_row_item img").each(function() { 46 if($(this).attr('cis_loaded') == 'loaded') 47 return; 48 cis_make_pr($(this)); 49 }); 50 51 function cis_make_pr($el) { 52 if($el.attr('cis_loaded') == 'loaded') 53 return; 54 var item_width = $el.width(); 55 $el.parents('.cis_row_item').find('.cis_row_item_loader').animate({ 56 width: item_width 57 },400,'swing',function() { 58 $el.parents('.cis_row_item').find('.cis_row_item_loader').fadeOut(200,function() { 59 $el.parents('.cis_row_item_inner').hide().removeClass('cis_row_hidden_element').fadeIn(200); 60 }); 61 }); 62 }; 63 64}); 65 66$(document).ready(function() { 67 //creative popup/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 68 69 /* 70 //add popup html 71 */ 72 function cis_add_creative_popup_html() { 73 var cis_base = $(".cis_main_wrapper").attr("cis_base"); 74 var popup_loader_loading_class = 'cis_popup_wrapper_loader'; 75 var loader_popup_html = '<div class="cis_popup_wrapper '+ popup_loader_loading_class +'" cis_popup_autoplay="2"><div class="cis_popup_autoplay_bar_holder"><div class="cis_popup_autoplay_bar_wrapper"><div class="cis_popup_autoplay_bar"></div></div></div><div class="cis_popup_item_holder"><img src="" class="cis_popup_left_arrow" /><img src="" class="cis_popup_right_arrow" /><div class="cis_popup_item_order_info"></div><img src="' + cis_base + '/components/com_creativeimageslider/assets/images/play.png" class="cis_popup_autoplay_play" /><img src="' + cis_base + '/components/com_creativeimageslider/assets/images/pause.png" class="cis_popup_autoplay_pause cis_popup_topright_icon_hidden"/><img src="' + cis_base + '/components/com_creativeimageslider/assets/images/close.png" class="cis_popup_close" /><div style="height: auto;font-weight: normal;text-shadow: rgb(0, 0, 0) 0px 3px 3px;padding: 4px 10px 5px 8px;line-height: 15px;color: rgb(255, 255, 255);font-style: italic;font-size: 12px;position: absolute;display: block;z-index: 10;bottom: 5px;right: -200px;background: rgba(0, 0, 0, 0.39);border: solid 1px rgba(68, 65, 65, 0.59);border-top-left-radius: 6px;border-bottom-left-radius: 6px;border-right: 0;box-shadow: 1px 1px 3px 1px rgba(5, 0, 0, 0.6);-webkit-box-shadow: 1px 1px 3px 1px rgba(5, 0, 0, 0.6);-moz-box-shadow: 1px 1px 3px 1px rgba(5, 0, 0, 0.6);opacity: 0.7;">By <a href="http://creative-solutions.net/joomla/creative-image-slider" target="_blank" style="font-weight: bold;color: rgb(72, 108, 253);">Creative Image Slider</a></div></div><div class="cis_popup_bottom_holder"></div></div>'; 76 $('body').append(loader_popup_html); 77 }; 78 cis_add_creative_popup_html(); 79 80 /* 81 //add overlay html 82 */ 83 function cis_add_creative_overlay_html() { 84 var overlay_html = '<div class="cis_main_overlay"></div>'; 85 $('body').append(overlay_html); 86 }; 87 cis_add_creative_overlay_html(); 88 89 /* 90 //popup event function 91 */ 92 $(".cis_main_wrapper").each(function() { 93 $(this).find(".cis_row_item_overlay").each(function() { 94 var $this = $(this); 95 var cis_popup_event = parseInt($this.attr("cis_popup_event")); 96 97 if(cis_popup_event == 0) {//open popup onclick of button 98 $this.find('.creative_btn').click(function(e) { 99 e.preventDefault(); 100 101 //show overlay 102 cis_show_creative_overlay(); 103 104 //show popup 105 var $loader = $(this).parents('.cis_row_item').find('.cis_row_item_inner'); 106 cis_animate_creative_popup($loader); 107 }); 108 } 109 else if(cis_popup_event == 1) {// open popup on click of overlay + button 110 // set cursos pointer css to overlay 111 $this.addClass('cis_cursor_pointer'); 112 // click functon 113 $this.click(function(e) { 114 //show overlay 115 cis_show_creative_overlay(); 116 117 //show popup 118 var $loader = $(this).parents('.cis_row_item').find('.cis_row_item_inner'); 119 cis_animate_creative_popup($loader); 120 }); 121 } 122 else if(cis_popup_event == 2) { // open link 123 var cis_click_target = parseInt($this.attr("cis_click_target")); 124 var cis_click_url = $this.attr("cis_click_url"); 125 var cis_button_visible = parseInt($this.attr("cis_button_visible")); 126 127 if(cis_button_visible == 0) {// if button not visible, onclick ov overlay open link 128 // set cursos pointer css to overlay 129 $this.addClass('cis_cursor_pointer'); 130 131 $this.click(function(e) { 132 if(cis_click_target == 1) 133 window.open(cis_click_url); 134 else 135 window.location.href = cis_click_url; 136 137 });
138 } 139 } 140 }); 141 }); 142 143 /* 144 //make items ordering 145 */ 146 function cis_make_creative_items_orders() { 147 $('.cis_main_wrapper').each(function(){ 148 var curr_order = 0; 149 $(this).find('.cis_row_item').each(function() { 150 $(this).attr("cis_item_order",curr_order) 151 curr_order ++; 152 }) 153 }) 154 }; 155 cis_make_creative_items_orders(); 156 157 /* 158 //overlay functions 159 */ 160 function cis_show_creative_overlay() { 161 var windowWidth = $(document).width(); //retrieve current window width 162 var windowHeight = $(document).height(); //retrieve current window height 163 $('.cis_main_overlay').css({'width':windowWidth,'height':windowHeight}).stop().fadeTo(400,0.8); 164 }; 165 function cis_resize_creative_overlay() { 166 var windowWidth = $(document).width(); //retrieve current window width 167 var windowHeight = $(document).height(); //retrieve current window height 168 $('.cis_main_overlay').css({'width':windowWidth,'height':windowHeight}); 169 }; 170 function cis_hide_creative_overlay() { 171 $('.cis_main_overlay').stop().fadeOut(400,function() { 172 $(this).css({'width':'100%','height':'100%'}); 173 //reset popup html 174 175 $('.cis_popup_item').remove(); 176 $('.cis_popup_bottom_holder').removeAttr("style").removeAttr("h").html(''); 177 $('.cis_popup_wrapper').removeClass('cis_popup_in_progress'); 178 }); 179 }; 180 181 /* 182 //function to create popup paths 183 */ 184 var cis_popup_paths = new Array(); 185 $('.cis_main_wrapper').each(function() { 186 var cis_slider_id = $(this).attr("cis_slider_id"); 187 cis_popup_paths[cis_slider_id] = new Array(); 188 var item_order = 0; 189 $(this).find('.cis_row_item').each(function() { 190 $this = $(this); 191 var item_popup_path = $(this).attr("cis_popup_link"); 192 193 if(item_popup_path != '') { 194 item_order ++; 195 cis_popup_paths[cis_slider_id][item_order] = item_popup_path; 196 $this.attr("cis_popup_order", item_order).addClass('cis_has_popup'); 197 } 198 }); 199 $(this).attr("cis_popup_items_count",item_order); 200 }); 201 202 203 /* 204 //function to animate popup 205 */ 206 function cis_animate_creative_popup($loader) { 207 //get popup image 208 var slider_id = $loader.parents('.cis_main_wrapper').attr("cis_slider_id"); 209 var slider_id_unique = $loader.parents('.cis_main_wrapper').attr("roll"); 210 var item_order = $loader.parents('.cis_row_item').attr("cis_popup_order"); 211 var item_id = $loader.parents('.cis_row_item').attr("item_id"); 212 var cis_popup_link = cis_popup_paths[slider_id][item_order]; 213 214 //get data 215 var slider_data =$loader.parents('.cis_main_wrapper').find('.cis_popup_data').html(); 216 var slider_data_array = slider_data.split(','); 217 var cis_popup_use_back_img = parseInt(slider_data_array[2]); 218 219 220 var $cis_popup = $('.cis_popup_wrapper'); 221 $cis_popup.addClass('cis_popup_in_progress'); 222 $cis_popup.attr("slider_id", slider_id_unique); 223 $cis_popup.addClass('cis_vissible'); 224 225 //show or hide overlay bg image 226 if(cis_popup_use_back_img == 0) 227 $('.cis_main_overlay').addClass('cis_main_overlay_without_bg'); 228 else 229 $('.cis_main_overlay').removeClass('cis_main_overlay_without_bg'); 230 231 232 var popup_loader_animate_timeout1 = 10; 233 setTimeout(function() { 234 //get loader sizes, coordinates 235 var w = parseInt($loader.css('width')); 236 var h = parseInt($loader.css('height')); 237 238 //get body borders 239 var body_border_top = parseInt($('body').css('border-top-width')); 240 var body_border_left = parseInt($('body').css('border-left-width')); 241 242 //get offsets 243 var offset_top = $loader.offset().top; 244 var offset_left = $loader.offset().left; 245 246 var offset_top_final = offset_top; 247 var offset_left_final = offset_left; 248 249 //scroll positions 250 var vScrollPosition = $(document).scrollTop(); //retrieve the document scroll ToP position 251 var hScrollPosition = $(document).scrollLeft(); //retrieve the document scroll Left position 252 253 //show popup 254 255 $cis_popup 256 .hide() 257 .attr("start_data", w + ',' + h + ',' + offset_top_final + ',' + offset_left_final + ',' + vScrollPosition + ',' + hScrollPosition) 258 .css({ 259 'width': w, 260 'height': h, 261 'top': offset_top, 262 'left': offset_left_final 263 }) 264 .fadeIn(400, function() { 265 cis_show_image(item_id); 266 }); 267 },popup_loader_animate_timeout1); 268 }; 269 270 //function to back the popup to start position 271 function cis_reset_creative_popup() { 272 var $cis_popup = $('.cis_popup_wrapper'); 273 var slider_id = $cis_popup.attr("slider_id"); 274 275 //hide arrows 276 cis_popup_hide_arrows(); 277 //hide image order data 278 cis_popup_hide_item_order(); 279 //hide popup autoplay bar 280 cis_popup_hide_autoplay_bar(); 281 //hide tpright arrows
282 cis_popup_hide_topright_icons(); 283 //hide back 284 cis_popup_hide_back(); 285 286 //check if popup is ready 287 if($cis_popup.hasClass('cis_popup_in_progress')) 288 return; 289 290 //set popup ready! 291 $cis_popup.addClass('cis_popup_in_progress'); 292 293 var $cis_popup_item = $cis_popup.find('.cis_popup_item'); 294 var $cis_popup_bottom = $cis_popup.find('.cis_popup_bottom_holder'); 295 296 $cis_popup.removeClass("cis_vissible"); 297 298 var start_data = $cis_popup.attr("start_data"); 299 var start_data_array = start_data.split(","); 300 var bottom_h = parseInt($cis_popup.find('.cis_popup_bottom_holder').attr("h")); 301 302 var cis_popup_animate_back_timeout = 0; 303 setTimeout(function() { 304 305 //hide item 306 $cis_popup_item.fadeOut(400); 307 308 $('.cis_main_overlay').stop().fadeTo(400,0.8); 309 310 //animate main popup 311 $cis_popup.stop().animate({ 312 'height':'-=' + bottom_h 313 }, 314 { 315 duration: 400, 316 queue: false, 317 easing: 'swing', 318 complete: function() { 319 setTimeout(function() { 320 $("body").stop().animate({ 321 scrollTop: start_data_array[4] 322 },400); 323 324 $cis_popup 325 .removeClass("cis_popup_wrapper_loader_shaddow") 326 .animate({ 327 'width': start_data_array[0], 328 'height': start_data_array[1], 329 'top': start_data_array[2], 330 'left': start_data_array[3] 331 },400,'swing', function() { 332 $cis_popup.fadeOut(400); 333 cis_hide_creative_overlay(); 334 335 // trigger mouseleave, to continue auto-play(if exists). 336 $('.cis_wrapper_' + slider_id).trigger("mouseleave"); 337 338 // show back 339 $('.cis_main_wrapper').each(function() { 340 var roll = $(this).attr("roll"); 341 if(roll == slider_id) { 342 cis_show_back_canvas($(this).children('div').last()); 343 } 344 }); 345 }); 346 },100); 347 } 348 }); 349 350 //animate popup bottom 351 $cis_popup_bottom.stop().animate({ 352 'height':'0' 353 }, 354 { 355 duration: 400, 356 queue: false, 357 easing: 'swing', 358 complete: function() { 359 $(this).hide(); 360 } 361 }); 362 },cis_popup_animate_back_timeout); 363 364 }; 365 366 367 function cis_show_image(item_id) { 368 $loader = $("#cis_item_" + item_id).find('.cis_row_item_inner'); 369 370 var $cis_popup = $('.cis_popup_wrapper'); 371 $cis_popup.addClass('cis_vissible'); 372 $cis_popup.attr("item_id", item_id); 373 374 //get popup image 375 var slider_id = $loader.parents('.cis_main_wrapper').attr("cis_slider_id"); 376 var item_order = $loader.parents('.cis_row_item').attr("cis_popup_order"); 377 var items_count = $loader.parents('.cis_main_wrapper').attr("cis_popup_items_count"); 378 var cis_popup_link = cis_popup_paths[slider_id][item_order]; 379 380 //get data 381 var slider_data =$loader.parents('.cis_main_wrapper').find('.cis_popup_data').html(); 382 var slider_data_array = slider_data.split(','); 383 var cis_popup_max_size = parseInt(slider_data_array[0]); 384 var cis_popup_item_min_width = parseInt(slider_data_array[1]); 385 386 // set item order info 387 var cis_popup_item_order_text = item_order + ' of ' + items_count; 388 $('.cis_popup_item_order_info').html(cis_popup_item_order_text) 389 390 var cis_title = $("#cis_item_" + item_id).find('.cis_row_item_overlay_txt').html();
391 var cis_desc = $("#cis_item_" + item_id).find('.cis_popup_caption').html(); 392 393 // if url is empty, reset popup 394 if(cis_popup_link == '' || cis_popup_link == undefined) { 395 $cis_popup.removeClass('cis_popup_in_progress') 396 cis_reset_creative_popup(); 397 }; 398 399 //load image 400 var $popup_img = $("<img />", { src:cis_popup_link,class:'cis_popup_item'}); 401 $popup_img 402 .error(function() { 403 alert("Error loading image"); 404 console.log("Error loading image. Url: " + cis_popup_link); 405 $cis_popup.removeClass('cis_popup_in_progress') 406 cis_reset_creative_popup(); 407 }) 408 .load(function() { 409 410 $popup_img.addClass('cis_hidden').appendTo("body"); 411 412 var img_width = parseInt($popup_img.width()); 413 var img_height = parseInt($popup_img.height()); 414 var img_ratio = img_height / img_width; 415 var img_width_final = img_width; 416 var img_height_final = img_height; 417 418 $popup_img.attr("w",img_width); 419 $popup_img.attr("h",img_height); 420 421 var $popup_img_final = $popup_img; 422 $popup_img.remove(); 423 $popup_img_final.removeClass('cis_hidden'); 424 425 //$cis_popup.find('.cis_popup_item_holder').prepend($popup_img_final); 426 427 var windowWidth = parseInt($(window).width()); //retrieve current window width 428 var windowHeight = parseInt($(window).height()); //retrieve current window height 429 var vScrollPosition = parseInt($(document).scrollTop()); //retrieve the document scroll ToP position 430 var hScrollPosition = parseInt($(document).scrollLeft()); //retrieve the document scroll Left position 431 432 // set limits 433 var cis_max_percent_w = cis_popup_max_size; 434 var cis_max_percent_h = cis_popup_max_size; 435 436 // calculate max sizes 437 var max_allowed_w = parseInt(windowWidth * cis_max_percent_w / 100); 438 var max_allowed_h = parseInt(windowHeight * cis_max_percent_h / 100); 439 440 //if image height greater than max allowed size, make corrections! 441 if(img_height > max_allowed_h) { 442 var img_height_check = max_allowed_h; 443 var img_width_check = max_allowed_h / img_ratio; 444 445 //check if calculated with in allowed range 446 if(img_width_check > max_allowed_w) { 447 img_width_check = max_allowed_w; 448 img_height_check = max_allowed_w * img_ratio; 449 } 450 451 //set values 452 img_width_final = img_width_check; 453 img_height_final = img_height_check; 454 455 } 456 else if(img_width > max_allowed_w) { 457 var img_width_check = max_allowed_w; 458 var img_height_check = max_allowed_w * img_ratio; 459 460 //check if calculated with in allowed range 461 if(img_height_check > max_allowed_h) { 462 img_height_check = max_allowed_h; 463 img_width_check = max_allowed_h / img_ratio; 464 } 465 466 //set values 467 img_width_final = img_width_check; 468 img_height_final = img_height_check; 469 } 470 471 // get autoplay bar 472 var $autoplay_bar_holder = $('.cis_popup_autoplay_bar_holder'); 473 var $autoplay_bar_holder = $('.cis_popup_autoplay_bar'); 474 var autolplay_bar_h = parseInt($autoplay_bar_holder.attr("h")); 475 476 //get bottom 477 var bottom_htm = '<div class="cis_popup_bottom_inner_wrapper cis_hidden"><div class="cis_popup_bottom_inner">'; 478 bottom_htm += '<div class="cis_popup_bottom_title">' + cis_title + '</div>'; 479 if(cis_desc != '') 480 bottom_htm += '<div class="cis_popup_bottom_desc">' + cis_desc + '</div>'; 481 bottom_htm += '<div class="cis_popup_bottom_line"></div></div></div>'; 482 483 //get bottom height 484 var bottom_htm_dummy = bottom_htm; 485 $cis_popup.append(bottom_htm_dummy); 486 $(".cis_popup_bottom_inner_wrapper").width(img_width_final); 487 var bottom_height = $(".cis_popup_bottom_inner_wrapper").height(); 488 489 // check if total width in allowed range 490 if(img_height_final + 1*bottom_height > max_allowed_h) { 491 img_height_final = max_allowed_h - bottom_height; 492 img_height_final = img_height_final > img_height ? img_height : img_height_final; 493 img_width_final = img_height_final / img_ratio; 494 495 //check min size 496 var cis_min_width = cis_popup_item_min_width; 497 if(img_width_final < cis_min_width) { 498 img_width_final = cis_min_width;
499 img_height_final = img_width_final * img_ratio; 500 } 501 } 502 503 //calculate buttom height again 504 $cis_popup.append(bottom_htm_dummy); 505 $(".cis_popup_bottom_inner_wrapper").width(img_width_final); 506 bottom_height = $(".cis_popup_bottom_inner_wrapper").height(); 507 508 $(".cis_popup_bottom_inner_wrapper").remove(); 509 $cis_popup.find('.cis_popup_bottom_holder').attr("h",bottom_height).hide().html(bottom_htm); 510 $(".cis_popup_bottom_inner_wrapper").removeClass('cis_hidden'); 511 512 //get final offsets 513 var popup_top_final = vScrollPosition + 0.3*(windowHeight - img_height_final - bottom_height); 514 //if we have negative top offset, turn off scrolling behaviour, set fixed top position 515 var cis_scroll_disable = false; 516 if(popup_top_final < vScrollPosition) { 517 popup_top_final = vScrollPosition + 12*1; 518 if(!$cis_popup.hasClass('cis_popup_disable_scrolling_behaviour')) 519 $cis_popup.addClass('cis_popup_disable_scrolling_behaviour') 520 cis_scroll_disable = true; 521 } 522 else { 523 $cis_popup.removeClass('cis_popup_disable_scrolling_behaviour') 524 } 525 526 var popup_left_final = hScrollPosition + 0.5 * (windowWidth - img_width_final); 527 //if we have negative top offset, turn off scrolling behaviour, set fixed top position 528 if(popup_left_final < hScrollPosition) { 529 popup_left_final = hScrollPosition + 12*1; 530 if(!$cis_popup.hasClass('cis_popup_disable_scrolling_behaviour')) 531 $cis_popup.addClass('cis_popup_disable_scrolling_behaviour') 532 } 533 else if(!cis_scroll_disable){ 534 $cis_popup.removeClass('cis_popup_disable_scrolling_behaviour') 535 } 536 537 //place image 538 $popup_img_final.css({ 539 'width': img_width_final, 540 'height': img_height_final, 541 'display': 'none' 542 }); 543 544 $cis_popup.find('.cis_popup_item_holder').prepend($popup_img_final); 545 546 //animate popup 547 $cis_popup.stop().animate({ 548 'width': img_width_final, 549 'height': img_height_final, 550 'top' : popup_top_final, 551 'left' : popup_left_final 552 },400, 'easeOutBack', function() { 553 //show image 554 $popup_img_final.stop().fadeIn(400,function() { 555 556 $('.cis_main_overlay').stop().fadeTo(400,0.96); 557 $cis_popup.addClass('cis_popup_wrapper_loader_shaddow'); 558 559 //$cis_popup.find('.cis_popup_bottom_holder').css('visibility','visible'); 560 //prepare bottom 561 $cis_popup.stop().animate({ 562 'height': '+=' + bottom_height 563 },400,'swing',function() { 564 565 //set popup ready! 566 $cis_popup.removeClass('cis_popup_in_progress'); 567 568 //prepare arrows 569 cis_prepare_popup_arrows(); 570 571 //prepare order info 572 cis_popup_prepare_item_order_info(); 573 574 //show autoplay bar wrapper 575 cis_popup_show_autoplay_bar(); 576 577 // prepare top-right icons 578 cis_popup_prepare_topright_icons(); 579 580 // prepare popup autoplay 581 cis_popup_prepare_autoplay(); 582 583 // prepare back 584 cis_popup_prepare_back(); 585 }); 586 587 //animate bottom inner 588 $cis_popup.find('.cis_popup_bottom_holder').stop().fadeIn(400); 589 590 }); 591 592 }); 593 594 }); 595 }; 596 597 function cis_resize_image() { 598 var $cis_popup = $('.cis_popup_wrapper'); 599 600 //check if popup is ready 601 if($cis_popup.hasClass('cis_popup_in_progress')) 602 return; 603 604 //return, if popup is not visible 605 if(!$cis_popup.hasClass('cis_vissible')) 606 return; 607 608 // get item id 609 var item_id = $cis_popup.attr("item_id"); 610 $loader = $("#cis_item_" + item_id).find('.cis_row_item_inner'); 611 612 //get data 613 var slider_data =$loader.parents('.cis_main_wrapper').find('.cis_popup_data').html(); 614 var slider_data_array = slider_data.split(','); 615 var cis_popup_max_size = parseInt(slider_data_array[0]); 616 var cis_popup_item_min_width = parseInt(slider_data_array[1]); 617 618 //get image 619 var $popup_img = $('.cis_popup_item'); 620 $popup_img.css({'width':'100%','height':'auto'}) 621 622 // get sizes 623 var img_width = parseInt($popup_img.attr("w")); 624 var img_height = parseInt($popup_img.attr("h")); 625 var img_ratio = img_height / img_width; 626 var img_width_final = img_width; 627 var img_height_final = img_height; 628 629 var windowWidth = parseInt($(window).width()); //retrieve current window width 630 var windowHeight = parseInt($(window).height()); //retrieve current window height 631 var vScrollPosition = parseInt($(document).scrollTop()); //retrieve the document scroll ToP position 632 var hScrollPosition = parseInt($(document).scrollLeft()); //retrieve the document scroll Left position 633 634 // set limits 635 var cis_max_percent_w = cis_popup_max_size; 636 var cis_max_percent_h = cis_popup_max_size; 637 638 // calculate max sizes 639 var max_allowed_w = parseInt(windowWidth * cis_max_percent_w / 100); 640 var max_allowed_h = parseInt(windowHeight * cis_max_percent_h / 100); 641 642 //if image height greater than max allowed size, make corrections! 643 if(img_height > max_allowed_h) { 644 var img_height_check = max_allowed_h; 645 var img_width_check = max_allowed_h / img_ratio; 646 647 //check if calculated with in allowed range 648 if(img_width_check > max_allowed_w) { 649 img_width_check = max_allowed_w; 650 img_height_check = max_allowed_w * img_ratio; 651 } 652 653 //set values 654 img_width_final = img_width_check; 655 img_height_final = img_height_check; 656 657 } 658 else if(img_width > max_allowed_w) { 659 var img_width_check = max_allowed_w; 660 var img_height_check = max_allowed_w * img_ratio; 661 662 //check if calculated with in allowed range 663 if(img_height_check > max_allowed_h) { 664 img_height_check = max_allowed_h; 665 img_width_check = max_allowed_h / img_ratio; 666 } 667 668 //set values 669 img_width_final = img_width_check; 670 img_height_final = img_height_check; 671 } 672 673 var bottom_height = parseInt($(".cis_popup_bottom_holder").attr("h")); 674 675 // check if total width in allowed range 676 if(img_height_final + 1*bottom_height > max_allowed_h) { 677 img_height_final = max_allowed_h - bottom_height; 678 img_height_final = img_height_final > img_height ? img_height : img_height_final; 679 img_width_final = img_height_final / img_ratio; 680 681 //check min size 682 var cis_min_width = cis_popup_item_min_width; 683 if(img_width_final < cis_min_width) { 684 img_width_final = cis_min_width;
685 img_height_final = img_width_final * img_ratio; 686 } 687 } 688 689 // calculate buttom height again 690 var bottom_htm_dummy = $('.cis_popup_bottom_inner_wrapper').html(); 691 bottom_htm_dummy = '<div class="cis_popup_bottom_inner_wrapper_dummy cis_hidden">' + bottom_htm_dummy + '</div>'; 692 693 $cis_popup.append(bottom_htm_dummy); 694 $(".cis_popup_bottom_inner_wrapper_dummy").width(img_width_final); 695 bottom_height = $(".cis_popup_bottom_inner_wrapper_dummy").height(); 696 697 $(".cis_popup_bottom_inner_wrapper_dummy").remove(); 698 $cis_popup.find('.cis_popup_bottom_holder').attr("h",bottom_height); 699 700 //get final offsets 701 var popup_top_final = vScrollPosition + 0.3*(windowHeight - img_height_final - bottom_height); 702 //if we have negative top offset, turn off scrolling behaviour, set fixed top position 703 var cis_scroll_disable = false; 704 if(popup_top_final < vScrollPosition) { 705 popup_top_final = vScrollPosition + 12*1; 706 if(!$cis_popup.hasClass('cis_popup_disable_scrolling_behaviour')) 707 $cis_popup.addClass('cis_popup_disable_scrolling_behaviour') 708 cis_scroll_disable = true; 709 } 710 else { 711 $cis_popup.removeClass('cis_popup_disable_scrolling_behaviour') 712 } 713 714 var popup_left_final = hScrollPosition + 0.5 * (windowWidth - img_width_final); 715 //if we have negative top offset, turn off scrolling behaviour, set fixed top position 716 if(popup_left_final < hScrollPosition) { 717 popup_left_final = hScrollPosition + 12*1; 718 if(!$cis_popup.hasClass('cis_popup_disable_scrolling_behaviour')) 719 $cis_popup.addClass('cis_popup_disable_scrolling_behaviour') 720 } 721 else if(!cis_scroll_disable){ 722 $cis_popup.removeClass('cis_popup_disable_scrolling_behaviour') 723 }; 724 725 726 //animate popup 727 var total_h = img_height_final + 1*bottom_height; 728 $cis_popup.stop().animate({ 729 'width': img_width_final, 730 'height': total_h, 731 'top' : popup_top_final, 732 'left' : popup_left_final 733 },400,'easeOutBack', function() { 734 //resize arrows 735 cis_resize_popup_arrows(); 736 }); 737 738 }; 739 740 function cis_move_image() { 741 var $cis_popup = $('.cis_popup_wrapper'); 742 743 //check if popup is ready 744 if($cis_popup.hasClass('cis_popup_in_progress')) 745 return; 746 747 //return, if popup is not visible 748 if(!$cis_popup.hasClass('cis_vissible')) 749 return; 750 751 // return, if scrolling not enabled 752 if($cis_popup.hasClass('cis_popup_disable_scrolling_behaviour')) 753 return; 754 755 var item_id = $cis_popup.attr("item_id"); 756 757 var popup_width = $cis_popup.width(); 758 var popup_height = $cis_popup.height(); 759 760 var windowWidth = $(window).width(); //retrieve current window width 761 var windowHeight = $(window).height(); //retrieve current window height 762 var vScrollPosition = $(document).scrollTop(); //retrieve the document scroll ToP position 763 var hScrollPosition = $(document).scrollLeft(); //retrieve the document scroll Left position 764 765 //get final offsets 766 var popup_top_final = vScrollPosition + 0.3*(windowHeight - popup_height); 767 var popup_left_final = (windowWidth - popup_width) / 2; 768 769 //animate popup 770 $cis_popup.stop(false,false).animate({ 771 'top' : popup_top_final, 772 'left' : popup_left_final 773 },400, 'swing'); 774 775 }; 776 777 $(window).scroll(function() { 778 cis_move_image(); 779 }); 780 781 $(window).resize(function() { 782 cis_resize_creative_overlay(); 783 clearTimeout($.data(this, 'cisResizeTimer')); 784 $.data(this, 'cisResizeTimer', setTimeout(function() { 785 cis_resize_image(); 786 }, 200)); 787 }); 788 789 //keyup 790 $(document).keyup(function (e) { 791 var cis_keycode = e.keyCode; 792 if (cis_keycode == 37 || cis_keycode == 39 || cis_keycode == 27) { 793 var $cis_popup = $('.cis_popup_wrapper'); 794 if($cis_popup.hasClass('cis_vissible')) { 795 if(cis_keycode == 27) // reset popup when typr ESC button 796 cis_reset_creative_popup(); 797 else if(cis_keycode == 39) // show next when type right button 798 cis_popup_show_next_item(); 799 else if(cis_keycode == 37) // show prev when type left button 800 cis_popup_show_prev_item(); 801 } 802 } 803 }); 804 805 $(".cis_main_overlay").on('click', function() { 806 cis_reset_creative_popup(); 807 }); 808 809 // prepare back 810 function cis_popup_prepare_back() { 811 var $cis_popup = $('.cis_popup_wrapper'); 812 var item_id = $cis_popup.attr("item_id"); 813 814 cis_popup_show_back(); 815 816 // set hover functions 817 $cis_popup.on('mouseenter.cis_popup_hover_handler', function() { 818 cis_popup_show_back(); 819 }); 820 $cis_popup.on('mouseleave.cis_popup_hover_handler', function() { 821 cis_popup_hide_back(); 822 }); 823 }; 824 function cis_popup_show_back() { 825 var $back = $('.cis_popup_wrapper').find('.cis_popup_item_holder').children('div').last();
826 $back.stop(true,false).animate({ 827 'right': '0' 828 },400,'easeOutBack'); 829 }; 830 function cis_popup_hide_back() { 831 var $back = $('.cis_popup_wrapper').find('.cis_popup_item_holder').children('div').last(); 832 $back.stop(true,false).animate({ 833 'right': '-200' 834 },400,'easeInBack'); 835 }; 836 837 838 //popup arrow navigation 839 function cis_prepare_popup_arrows() { 840 var $cis_popup = $('.cis_popup_wrapper'); 841 var item_id = $cis_popup.attr("item_id"); 842 843 // get slider arrows 844 var $left_arrow = $("#cis_item_" + item_id).parents('.cis_main_wrapper').find('.cis_button_left'); 845 var $right_arrow = $("#cis_item_" + item_id).parents('.cis_main_wrapper').find('.cis_button_right'); 846 847 var $cis_popup_left_arrow = $('.cis_popup_left_arrow'); 848 var $cis_popup_right_arrow = $('.cis_popup_right_arrow'); 849 850 //get data 851 var slider_data = $("#cis_item_" + item_id).parents('.cis_main_wrapper').find('.cis_popup_data').html(); 852 var slider_data_array = slider_data.split(','); 853 var cis_popup_arrow_min_height = parseInt(slider_data_array[5]); 854 var cis_popup_arrow_max_height = parseInt(slider_data_array[6]); 855 var cis_popup_showarrows = parseInt(slider_data_array[7]); 856 var cis_popup_arrow_passive_opacity = parseInt(slider_data_array[3]) / 100; 857 var cis_popup_arrow_left_offset = parseInt(slider_data_array[4]); 858 859 //set arrow attributes 860 var cis_corner_offset = cis_popup_arrow_left_offset; 861 $cis_popup_left_arrow.attr({"src":$left_arrow.attr("src"),'op':cis_popup_arrow_passive_opacity,'corner_offset':cis_corner_offset}); 862 $cis_popup_right_arrow.attr({"src":$right_arrow.attr("src"),'op':cis_popup_arrow_passive_opacity,'corner_offset':cis_corner_offset}); 863 864 //calculate arrow height 865 var cis_slider_h = parseInt($("#cis_item_" + item_id).parents('.cis_main_wrapper').find('.cis_row_item_inner').height()); 866 var cis_slider_arrow_h = parseInt($left_arrow.css("height")); 867 var arrow_ratio = cis_slider_arrow_h / cis_slider_h; 868 869 var arrow_max_h = parseInt($cis_popup_left_arrow.height()); 870 var arrow_container_height = parseInt($('.cis_popup_item_holder').height()); 871 872 arrow_max_h = cis_popup_arrow_max_height; 873 var arrow_min_h = cis_popup_arrow_min_height; 874 var arrow_h_claculated = arrow_container_height * 0.085; 875 var arrow_h_final = arrow_h_claculated > arrow_max_h ? arrow_max_h : (arrow_h_claculated < arrow_min_h ? arrow_min_h : arrow_h_claculated); 876 877 //get arrow position 878 var arrow_top = 0.5 * (arrow_container_height - arrow_h_final); 879 880 var arrow_op_pasive = cis_popup_arrow_passive_opacity; 881 882 // set arrows css 883 $cis_popup_left_arrow.css({ 884 'left': '-64px', 885 'top': arrow_top, 886 'height': arrow_h_final, 887 'opacity': arrow_op_pasive 888 }); 889 $cis_popup_right_arrow.css({ 890 'left': 'auto', 891 'right': '-64px', 892 'top': arrow_top, 893 'height': arrow_h_final, 894 'opacity': arrow_op_pasive 895 }); 896 897 898 var cis_popup_show_arrows_ident = cis_popup_showarrows; 899 900 //delete previously declired hover event 901 $cis_popup.off('mouseenter.cis_popup_hover_handler'); 902 $cis_popup.off('mouseleave.cis_popup_hover_handler'); 903 904 // arrow showing type 905 if(cis_popup_show_arrows_ident == 0) {//never show arrows 906 // Do Nothing 907 } 908 else if(cis_popup_show_arrows_ident == 1) {//show on hover 909 // show arrows 910 cis_popup_show_arrows(); 911 912 // set hover functions 913 $cis_popup.on('mouseenter.cis_popup_hover_handler', function() { 914 cis_popup_show_arrows(); 915 }); 916 $cis_popup.on('mouseleave.cis_popup_hover_handler', function() { 917 cis_popup_hide_arrows(); 918 }); 919 920 } 921 else { 922 cis_popup_show_arrows(); 923 } 924 925 }; 926 927 // resize popup arrows 928 function cis_resize_popup_arrows() { 929 var $cis_popup = $('.cis_popup_wrapper'); 930 var item_id = $cis_popup.attr("item_id"); 931 932 // get slider arrows 933 var $left_arrow = $("#cis_item_" + item_id).parents('.cis_main_wrapper').find('.cis_button_left'); 934 var $right_arrow = $("#cis_item_" + item_id).parents('.cis_main_wrapper').find('.cis_button_right'); 935 936 var $cis_popup_left_arrow = $('.cis_popup_left_arrow'); 937 var $cis_popup_right_arrow = $('.cis_popup_right_arrow'); 938 939 //calculate arrow height 940 var cis_slider_h = parseInt($("#cis_item_" + item_id).parents('.cis_main_wrapper').find('.cis_row_item_inner').height()); 941 var cis_slider_arrow_h = parseInt($left_arrow.css("height")); 942 var arrow_ratio = cis_slider_arrow_h / cis_slider_h; 943 944 var arrow_max_h = parseInt($cis_popup_left_arrow.height()); 945 var arrow_container_height = parseInt($('.cis_popup_item_holder').height()); 946 947 //get data 948 var slider_data = $("#cis_item_" + item_id).parents('.cis_main_wrapper').find('.cis_popup_data').html(); 949 var slider_data_array = slider_data.split(','); 950 var cis_popup_arrow_min_height = parseInt(slider_data_array[5]); 951 var cis_popup_arrow_max_height = parseInt(slider_data_array[6]); 952 var cis_popup_arrow_passive_opacity = parseInt(slider_data_array[3]); 953 954 arrow_max_h = cis_popup_arrow_max_height; 955 var arrow_min_h = cis_popup_arrow_min_height; 956 var arrow_h_claculated = arrow_container_height * 0.085; 957 var arrow_h_final = arrow_h_claculated > arrow_max_h ? arrow_max_h : (arrow_h_claculated < arrow_min_h ? arrow_min_h : arrow_h_claculated); 958 959 //get arrow position 960 var arrow_top = 0.5 * (arrow_container_height - arrow_h_final); 961 962 var arrow_op_pasive = cis_popup_arrow_passive_opacity; 963 964 // animate arrows 965 $cis_popup_left_arrow.stop().animate({ 966 'top': arrow_top, 967 'height': arrow_h_final 968 },400,'easeOutBack'); 969 $cis_popup_right_arrow.stop().animate({ 970 'top': arrow_top, 971 'height': arrow_h_final 972 },400,'easeOutBack'); 973 974 }; 975 976 function cis_popup_prepare_item_order_info() { 977 var $cis_popup = $('.cis_popup_wrapper'); 978 979 var item_id = $cis_popup.attr("item_id"); 980 981 //get data 982 var slider_data = $("#cis_item_" + item_id).parents('.cis_main_wrapper').find('.cis_popup_data').html(); 983 var slider_data_array = slider_data.split(','); 984 var cis_popup_image_order_opacity = parseInt(slider_data_array[8]) / 100; 985 var cis_popup_show_orderdata = parseInt(slider_data_array[10]); 986 987 var op_pasive = cis_popup_image_order_opacity;
988 $('.cis_popup_item_order_info').attr("op",op_pasive); 989 990 var cis_popup_show_item_order_ident = cis_popup_show_orderdata; 991 992 //delete previously declired hover function 993 $cis_popup.off('mouseenter.cis_popup_show_order_hover_handler'); 994 $cis_popup.off('mouseleave.cis_popup_show_order_hover_handler'); 995 996 // order info showing type 997 if(cis_popup_show_item_order_ident == 0) {//never show 998 // Do Nothing 999 } 1000 else if(cis_popup_show_item_order_ident == 1) {//show on hover 1001 // show arrows 1002 cis_popup_show_item_order(); 1003 1004 // set hover functions 1005 $cis_popup.on('mouseenter.cis_popup_show_order_hover_handler', function() { 1006 cis_popup_show_item_order(); 1007 }); 1008 $cis_popup.on('mouseleave.cis_popup_show_order_hover_handler', function() { 1009 cis_popup_hide_item_order(); 1010 }); 1011 1012 } 1013 else { //always show 1014 cis_popup_show_item_order(); 1015 } 1016 1017 }; 1018 1019 function cis_popup_prepare_topright_icons() { 1020 var $cis_popup = $('.cis_popup_wrapper'); 1021 1022 var item_id = $cis_popup.attr("item_id"); 1023 1024 //get data 1025 var slider_data = $("#cis_item_" + item_id).parents('.cis_main_wrapper').find('.cis_popup_data').html(); 1026 var slider_data_array = slider_data.split(','); 1027 var cis_popup_icons_opacity = parseInt(slider_data_array[11]) / 100; 1028 var cis_popup_show_icons = parseInt(slider_data_array[12]); 1029 1030 var op_pasive = cis_popup_icons_opacity; 1031 $('.cis_popup_autoplay_play').attr("op",op_pasive); 1032 $('.cis_popup_autoplay_pause').attr("op",op_pasive); 1033 $('.cis_popup_close').attr("op",op_pasive); 1034 1035 var cis_popup_show_topright_icons_ident = cis_popup_show_icons; 1036 1037 //delete previously declired hover function 1038 $cis_popup.off('mouseenter.cis_popup_show_topright_icons_hover_handler'); 1039 $cis_popup.off('mouseleave.cis_popup_show_topright_icons_hover_handler'); 1040 1041 // order info showing type 1042 if(cis_popup_show_topright_icons_ident == 0) {//never show 1043 // Do Nothing 1044 } 1045 else if(cis_popup_show_topright_icons_ident == 1) {//show on hover 1046 // show arrows 1047 cis_popup_show_topright_icons(); 1048 1049 // set hover functions 1050 $cis_popup.on('mouseenter.cis_popup_show_topright_icons_hover_handler', function() { 1051 cis_popup_show_topright_icons(); 1052 }); 1053 $cis_popup.on('mouseleave.cis_popup_show_topright_icons_hover_handler', function() { 1054 cis_popup_hide_topright_icons(); 1055 }); 1056 1057 } 1058 else { //always show 1059 cis_popup_show_topright_icons(); 1060 } 1061 1062 }; 1063 1064 /* 1065 // Function to show popup top-right icons 1066 */ 1067 var cis_popup_topright_icons_timeout1 = ''; 1068 var cis_popup_topright_icons_timeout2 = ''; 1069 function cis_popup_show_topright_icons() { 1070 var $cis_popup = $('.cis_popup_wrapper'); 1071 1072 //if animation in progress, do not show arrows 1073 if($cis_popup.hasClass('cis_popup_in_progress')) 1074 return; 1075 1076 //clear timeouts 1077 clearTimeout(cis_popup_topright_icons_timeout1); 1078 clearTimeout(cis_popup_topright_icons_timeout2); 1079 1080 var op_pasive = $('.cis_popup_close').attr("op"); 1081 1082 cis_popup_topright_icons_timeout1 = setTimeout(function() { 1083 $('.cis_popup_close').removeClass('disable_click').stop(true,false).animate({ 1084 'opacity': op_pasive 1085 // 'top': '12px' 1086 },400,'easeOutBack'); 1087 $('.cis_popup_autoplay_play').removeClass('disable_click').stop(true,false).animate({ 1088 'opacity': op_pasive 1089 // 'top': '12px' 1090 },400,'easeOutBack'); 1091 $('.cis_popup_autoplay_pause').removeClass('disable_click').stop(true,false).animate({ 1092 'opacity': op_pasive 1093 // 'top': '12px' 1094 },400,'easeOutBack'); 1095 },100); 1096 }; 1097 function cis_popup_hide_topright_icons() { 1098 var $cis_popup = $('.cis_popup_wrapper'); 1099 1100 //clear timeouts 1101 clearTimeout(cis_popup_topright_icons_timeout1); 1102 clearTimeout(cis_popup_topright_icons_timeout2); 1103 1104 $('.cis_popup_close').stop(true,false).fadeTo(400,0,function() { 1105 // $(this).css('top','-30px'); 1106 }); 1107 $('.cis_popup_autoplay_play').stop(true,false).fadeTo(400,0,function() { 1108 // $(this).css('top','-30px'); 1109 }); 1110 $('.cis_popup_autoplay_pause').stop(true,false).fadeTo(400,0,function() { 1111 // $(this).css('top','-30px'); 1112 }); 1113 1114 }; 1115 1116 /*
1117 // Function to show popup item order info 1118 */ 1119 var cis_popup_item_order_timeout1 = ''; 1120 var cis_popup_item_order_timeout2 = ''; 1121 function cis_popup_show_item_order() { 1122 var $cis_popup = $('.cis_popup_wrapper'); 1123 var item_id = $cis_popup.attr("item_id"); 1124 1125 //get data 1126 var slider_data = $("#cis_item_" + item_id).parents('.cis_main_wrapper').find('.cis_popup_data').html(); 1127 var slider_data_array = slider_data.split(','); 1128 var cis_popup_image_order_opacity = parseInt(slider_data_array[8]) / 100; 1129 var cis_popup_image_order_top_offset = parseInt(slider_data_array[9]); 1130 1131 //if animation in progress, do not show arrows 1132 if($cis_popup.hasClass('cis_popup_in_progress')) 1133 return; 1134 1135 //clear timeouts 1136 clearTimeout(cis_popup_item_order_timeout1); 1137 clearTimeout(cis_popup_item_order_timeout2); 1138 1139 var op_pasive = cis_popup_image_order_opacity; 1140 1141 cis_popup_item_order_timeout1 = setTimeout(function() { 1142 $('.cis_popup_item_order_info').stop(true,false).animate({ 1143 'opacity': op_pasive, 1144 'top': cis_popup_image_order_top_offset 1145 },400,'easeOutBack'); 1146 },100); 1147 }; 1148 function cis_popup_hide_item_order() { 1149 var $cis_popup = $('.cis_popup_wrapper'); 1150 1151 //clear timeouts 1152 clearTimeout(cis_popup_item_order_timeout1); 1153 clearTimeout(cis_popup_item_order_timeout2); 1154 1155 $('.cis_popup_item_order_info').stop().fadeTo(400,0,function() { 1156 $(this).css('top','-30px'); 1157 }); 1158 1159 }; 1160 1161 /* 1162 // Function to show/hide popup arrows 1163 */ 1164 var cis_popup_arrows_timeout1 = ''; 1165 var cis_popup_arrows_timeout2 = ''; 1166 function cis_popup_show_arrows() { 1167 var $cis_popup = $('.cis_popup_wrapper'); 1168 var item_id = $cis_popup.attr("item_id"); 1169 1170 //get data 1171 var slider_data = $("#cis_item_" + item_id).parents('.cis_main_wrapper').find('.cis_popup_data').html(); 1172 var slider_data_array = slider_data.split(','); 1173 var cis_popup_arrow_passive_opacity = parseInt(slider_data_array[3]) / 100; 1174 var cis_popup_arrow_left_offset = parseInt(slider_data_array[4]); 1175 1176 //if animation in progress, do not show arrows 1177 if($cis_popup.hasClass('cis_popup_in_progress')) 1178 return; 1179 1180 //clear timeouts 1181 clearTimeout(cis_popup_arrows_timeout1); 1182 clearTimeout(cis_popup_arrows_timeout2); 1183 1184 var $left_arrow = $cis_popup.find('.cis_popup_left_arrow'); 1185 var $right_arrow = $cis_popup.find('.cis_popup_right_arrow'); 1186 1187 var corner_offset = cis_popup_arrow_left_offset; 1188 var op_passive = cis_popup_arrow_passive_opacity; 1189 1190 var animation_time = 400; 1191 var start_offset = -64; 1192 var effect = 'easeOutBack'; 1193 1194 cis_popup_arrows_timeout1 = setTimeout(function() { 1195 $left_arrow.stop(true,false).animate({ 1196 'left': corner_offset, 1197 'opacity': op_passive 1198 },animation_time,effect); 1199 1200 $right_arrow.stop(true,false).animate({ 1201 'right': corner_offset, 1202 'opacity': op_passive 1203 },animation_time,effect); 1204 },100); 1205 1206 }; 1207 function cis_popup_hide_arrows() { 1208 var $cis_popup = $('.cis_popup_wrapper'); 1209 1210 //clear timeouts 1211 clearTimeout(cis_popup_arrows_timeout1); 1212 clearTimeout(cis_popup_arrows_timeout2); 1213 1214 var $left_arrow = $cis_popup.find('.cis_popup_left_arrow'); 1215 var $right_arrow = $cis_popup.find('.cis_popup_right_arrow'); 1216 1217 $left_arrow.fadeTo(200,0.2); 1218 $right_arrow.fadeTo(200,0.2); 1219 1220 var animation_time = 400; 1221 var start_offset = -64; 1222 var effect = 'easeInBack'; 1223 1224 cis_popup_arrows_timeout2 = setTimeout(function() { 1225 $left_arrow.stop(true,false).animate({ 1226 'left': start_offset 1227 },animation_time,effect); 1228 1229 $right_arrow.stop(true,false).animate({ 1230 'right': start_offset 1231 },animation_time,effect); 1232 },200); 1233 }; 1234 1235 // popup top right functions 1236 $('.cis_popup_close').on('click', function() { 1237 cis_reset_creative_popup(); 1238 }); 1239 1240 $('.cis_popup_close').on('mouseenter', function() { 1241 if($(this).hasClass('disable_click')) 1242 return; 1243 1244 $(this).stop(true,false).animate({ 1245 'opacity' : 1 1246 },300); 1247 }); 1248 $('.cis_popup_close').on('mouseleave', function() { 1249 if($(this).hasClass('disable_click')) 1250 return; 1251 1252 var opacity_inactive = $(this).attr("op");
1253 $(this).stop(true,false).animate({ 1254 'opacity' : opacity_inactive 1255 },300); 1256 }); 1257 1258 $('.cis_popup_autoplay_play').on('mouseenter', function() { 1259 if($(this).hasClass('disable_click')) 1260 return; 1261 1262 $(this).stop(true,false).animate({ 1263 'opacity' : 1 1264 },300); 1265 1266 }); 1267 $('.cis_popup_autoplay_play').on('mouseleave', function() { 1268 if($(this).hasClass('disable_click')) 1269 return; 1270 1271 var opacity_inactive = $(this).attr("op"); 1272 $(this).stop(true,false).animate({ 1273 'opacity' : opacity_inactive 1274 },300); 1275 1276 }); 1277 $('.cis_popup_autoplay_pause').on('mouseenter', function() { 1278 if($(this).hasClass('disable_click')) 1279 return; 1280 1281 $(this).stop(true,false).animate({ 1282 'opacity' : 1 1283 },300); 1284 1285 }); 1286 $('.cis_popup_autoplay_pause').on('mouseleave', function() { 1287 if($(this).hasClass('disable_click')) 1288 return; 1289 1290 var opacity_inactive = $(this).attr("op"); 1291 $(this).stop(true,false).animate({ 1292 'opacity' : opacity_inactive 1293 },300); 1294 1295 }); 1296 1297 // popup item order info hover functions 1298 $('.cis_popup_item_order_info').on('mouseenter', function() { 1299 $(this).stop(true,false).animate({ 1300 'opacity' : 1 1301 },300); 1302 }); 1303 $('.cis_popup_item_order_info').on('mouseleave', function() { 1304 var opacity_inactive = $(this).attr("op"); 1305 $(this).stop(true,false).animate({ 1306 'opacity' : opacity_inactive 1307 },300); 1308 }); 1309 1310 // popup arrows hover functions 1311 $('.cis_popup_left_arrow').on('mouseenter', function() { 1312 $(this).animate({ 1313 'opacity' : 1 1314 },300); 1315 }); 1316 $('.cis_popup_left_arrow').on('mouseleave', function() { 1317 var opacity_inactive = $(this).attr("op"); 1318 $(this).animate({ 1319 'opacity' : opacity_inactive 1320 },300); 1321 }); 1322 $('.cis_popup_right_arrow').on('mouseenter', function() { 1323 $(this).animate({ 1324 'opacity' : 1 1325 },300); 1326 }); 1327 $('.cis_popup_right_arrow').on('mouseleave', function() { 1328 var opacity_inactive = $(this).attr("op"); 1329 $(this).animate({ 1330 'opacity' : opacity_inactive 1331 },300); 1332 }); 1333 1334 // popup autoplay functions ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1335 1336 var cis_popup_autoplay_start_timeout = ''; 1337 function cis_popup_prepare_autoplay() { 1338 var $cis_popup = $('.cis_popup_wrapper'); 1339 var item_id = $cis_popup.attr("item_id"); 1340 1341 // show play icon 1342 $('.cis_popup_autoplay_pause').addClass('cis_popup_topright_icon_hidden'); 1343 $('.cis_popup_autoplay_play').removeClass('cis_popup_topright_icon_hidden'); 1344 1345 //fixed bug 1346 $('.cis_popup_autoplay_bar').stop(true,false).css('width','0%'); 1347 1348 //get data 1349 var slider_data = $("#cis_item_" + item_id).parents('.cis_main_wrapper').find('.cis_popup_data').html(); 1350 var slider_data_array = slider_data.split(','); 1351 var cis_popup_autoplay_default = parseInt(slider_data_array[13]); 1352 1353 var cis_popup_autoplay_enabled = cis_popup_autoplay_default; 1354 var cis_popup_autoplay_index = parseInt($cis_popup.attr("cis_popup_autoplay")); 1355 1356 if((cis_popup_autoplay_index == 2 && cis_popup_autoplay_enabled == 1) || cis_popup_autoplay_index == 1 ) { 1357 cis_popup_autoplay_start_timeout = setTimeout(function() { 1358 cis_popup_make_autoplay_start(); 1359 },1200); 1360 } 1361 1362 // autoplay hover functionality - will be activated, if will be requested! 1363 // var cis_popup_autoplay_ident = 1;//if 1, turn on autoplay hover functionlaity, if 2 - no! 1364 1365 //delete previously declired hover function 1366 // $cis_popup.off('mouseenter.cis_popup_autoplay_hover_handler'); 1367 // $cis_popup.off('mouseleave.cis_popup_autoplay_hover_handler'); 1368 1369 // if(cis_popup_autoplay_ident == 1) {//show on hover 1370 // // show arrows 1371 // cis_popup_make_autoplay_start(); 1372 1373 // // set hover functions 1374 // $cis_popup.on('mouseenter.cis_popup_autoplay_hover_handler', function() { 1375 // cis_popup_make_autoplay_stop(); 1376 // }); 1377 // $cis_popup.on('mouseleave.cis_popup_autoplay_hover_handler', function() { 1378 // cis_popup_make_autoplay_start(); 1379 // }); 1380 1381 // } 1382 // else { //always show 1383 // cis_popup_make_autoplay_start(); 1384 // } 1385 }; 1386 1387 $('.cis_popup_autoplay_play').on('click', function() { 1388 if($(this).hasClass('disable_click')) 1389 return; 1390 cis_popup_make_autoplay_start(); 1391 }); 1392 $('.cis_popup_autoplay_pause').on('click', function() { 1393 if($(this).hasClass('disable_click')) 1394 return; 1395 cis_popup_make_autoplay_stop(); 1396 }); 1397 1398 function cis_popup_make_autoplay_start() { 1399 var $cis_popup = $('.cis_popup_wrapper'); 1400 1401 //clear auto-play timeout 1402 clearTimeout(cis_popup_autoplay_start_timeout); 1403 // toggle icons 1404 $('.cis_popup_autoplay_play').addClass('cis_popup_topright_icon_hidden'); 1405 $('.cis_popup_autoplay_pause').removeClass('cis_popup_topright_icon_hidden'); 1406 1407 // set autoplay turned on 1408 $cis_popup.attr("cis_popup_autoplay","1"); 1409 1410 //strat autoplay 1411 cis_popup_autoplay_start(); 1412 }; 1413 function cis_popup_make_autoplay_stop() { 1414 var $cis_popup_autoplay_bar = $('.cis_popup_autoplay_bar'); 1415 1416 var bar_curr_width = parseFloat($cis_popup_autoplay_bar.width()); 1417 var bar_total_width = parseFloat($cis_popup_autoplay_bar.parent('div').width()); 1418 var curr_perc = 100 * bar_curr_width / bar_total_width; 1419 1420 if(curr_perc > 98) { 1421 return; 1422 } 1423 // toggle icons 1424 $('.cis_popup_autoplay_pause').addClass('cis_popup_topright_icon_hidden'); 1425 $('.cis_popup_autoplay_play').removeClass('cis_popup_topright_icon_hidden'); 1426 1427 //strat autoplay 1428 cis_popup_autoplay_stop(); 1429 }; 1430 1431 function cis_popup_autoplay_start() { 1432 var $cis_popup = $('.cis_popup_wrapper'); 1433 var item_id = $cis_popup.attr("item_id"); 1434 1435 var $cis_popup_autoplay_bar = $('.cis_popup_autoplay_bar'); 1436 1437 //get data 1438 var slider_data = $("#cis_item_" + item_id).parents('.cis_main_wrapper').find('.cis_popup_data').html(); 1439 var slider_data_array = slider_data.split(','); 1440 var cis_popup_autoplay_time = parseInt(slider_data_array[15]); 1441 1442 var animation_time = cis_popup_autoplay_time; 1443 1444 var bar_curr_width = parseFloat($cis_popup_autoplay_bar.width()); 1445 var bar_total_width = parseFloat($cis_popup_autoplay_bar.parent('div').width()); 1446 var curr_perc = 100 * bar_curr_width / bar_total_width; 1447 1448 var remained_perc = 100 - curr_perc; 1449 var animation_time_remained = animation_time * remained_perc / 100; 1450
1451 $cis_popup_autoplay_bar.stop(true,false).animate({ 1452 'width': '100%' 1453 },animation_time_remained,'linear', function() { 1454 1455 $('.cis_popup_close').addClass('disable_click'); 1456 $('.cis_popup_autoplay_pause').addClass('disable_click'); 1457 $('.cis_popup_autoplay_play').addClass('disable_click'); 1458 1459 cis_popup_show_next_item(); 1460 }); 1461 1462 }; 1463 1464 function cis_popup_autoplay_stop() { 1465 var $cis_popup = $('.cis_popup_wrapper'); 1466 1467 //clear auto-play timeout 1468 clearTimeout(cis_popup_autoplay_start_timeout); 1469 1470 // set autoplay turned off 1471 $cis_popup.attr("cis_popup_autoplay","0"); 1472 1473 var $cis_popup_autoplay_bar = $('.cis_popup_autoplay_bar'); 1474 var bar_curr_width = parseInt($cis_popup_autoplay_bar.width()); 1475 var animate_back_time = bar_curr_width * 0.9; 1476 1477 $cis_popup_autoplay_bar.stop(true,false).animate({ 1478 'width':'0%' 1479 },animate_back_time,'linear'); 1480 1481 }; 1482 1483 // popup arrow functions //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1484 $('.cis_popup_right_arrow').on('click', function() { 1485 cis_popup_show_next_item(); 1486 }); 1487 $('.cis_popup_left_arrow').on('click', function() { 1488 cis_popup_show_prev_item(); 1489 }); 1490 1491 function cis_popup_show_next_item() { 1492 var $cis_popup = $('.cis_popup_wrapper'); 1493 1494 //check if popup is ready 1495 if($cis_popup.hasClass('cis_popup_in_progress')) 1496 return; 1497 1498 var item_id = parseInt($cis_popup.attr("item_id")); 1499 var $original_item = $("#cis_item_" + item_id); 1500 1501 //get data 1502 var slider_data = $("#cis_item_" + item_id).parents('.cis_main_wrapper').find('.cis_popup_data').html(); 1503 var slider_data_array = slider_data.split(','); 1504 var cis_popup_closeonend = parseInt(slider_data_array[14]); 1505 1506 var slider_id = parseInt($original_item.parents('.cis_main_wrapper').attr("cis_slider_id")); 1507 var item_order = parseInt($original_item.attr("cis_popup_order")); 1508 var cis_popup_items_length = parseInt($original_item.parents('.cis_main_wrapper').attr("cis_popup_items_count")); 1509 1510 // if last item, return 1511 if(item_order == cis_popup_items_length) { 1512 var cis_popup_last_item_behaviour = cis_popup_closeonend; 1513 1514 if(cis_popup_last_item_behaviour == 1) { 1515 //close creative popup, if last item 1516 cis_reset_creative_popup(); 1517 } 1518 else { 1519 // show play icon 1520 $('.cis_popup_autoplay_pause').addClass('cis_popup_topright_icon_hidden'); 1521 $('.cis_popup_autoplay_play').removeClass('cis_popup_topright_icon_hidden'); 1522 1523 //reset bar 1524 $('.cis_popup_autoplay_bar').stop(true,false).animate({ 1525 'width': '0%' 1526 },400,'swing'); 1527 } 1528 return; 1529 } 1530 else { 1531 var active_item_id = parseInt($original_item.nextAll('.cis_row_item.cis_has_popup').first().attr("item_id")); 1532 1533 //hide arrows 1534 cis_popup_hide_arrows(); 1535 //hide image order data 1536 cis_popup_hide_item_order(); 1537 //hide popup autoplay bar 1538 cis_popup_hide_autoplay_bar(); 1539 //hide tpright arrows 1540 cis_popup_hide_topright_icons(); 1541 //hide back 1542 cis_popup_hide_back(); 1543 1544 // set animation progress class 1545 $cis_popup.addClass('cis_popup_in_progress'); 1546 1547 // the hiding animation accurs in 600ms, so we will hide existing item in that time 1548 var bottom_h = parseInt($cis_popup.find('.cis_popup_bottom_holder').attr("h")); 1549 1550 //animate main popup 1551 $cis_popup.stop().animate({ 1552 'height':'-=' + bottom_h 1553 },600,'swing', function() { 1554 $('.cis_popup_bottom_inner_wrapper').remove() 1555 }); 1556 1557 //animate bottom holder 1558 $('.cis_popup_bottom_holder').animate({ 1559 'height': 0 1560 },600,'swing'); 1561 1562 $('.cis_popup_item').stop().fadeTo(600,0, function() { 1563 $(this).remove(); 1564 1565 //show new item 1566 cis_show_image(active_item_id); 1567 }); 1568 }; 1569 }; 1570 1571 function cis_popup_show_prev_item() { 1572 var $cis_popup = $('.cis_popup_wrapper'); 1573 1574 //check if popup is ready 1575 if($cis_popup.hasClass('cis_popup_in_progress')) 1576 return; 1577 1578 var item_id = parseInt($cis_popup.attr("item_id")); 1579 var $original_item = $("#cis_item_" + item_id); 1580 1581 var slider_id = parseInt($original_item.parents('.cis_main_wrapper').attr("cis_slider_id")); 1582 var item_order = parseInt($original_item.attr("cis_popup_order")); 1583 var cis_popup_items_length = parseInt($original_item.parents('.cis_main_wrapper').attr("cis_popup_items_count"));
1584 1585 // if first item, return 1586 if(item_order == 1) { 1587 return; 1588 } 1589 else { 1590 var active_item_id = parseInt($original_item.prevAll('.cis_row_item.cis_has_popup').first().attr("item_id")); 1591 1592 //hide arrows 1593 cis_popup_hide_arrows(); 1594 //hide image order data 1595 cis_popup_hide_item_order(); 1596 //hide popup autoplay bar 1597 cis_popup_hide_autoplay_bar(); 1598 //hide tpright arrows 1599 cis_popup_hide_topright_icons(); 1600 1601 // set animation progress class 1602 $cis_popup.addClass('cis_popup_in_progress'); 1603 1604 // the hiding animation accurs in 600ms, so we will hide existing item in that time 1605 var bottom_h = parseInt($cis_popup.find('.cis_popup_bottom_holder').attr("h")); 1606 1607 //animate main popup 1608 $cis_popup.stop().animate({ 1609 'height':'-=' + bottom_h 1610 },600,'swing', function() { 1611 $('.cis_popup_bottom_inner_wrapper').remove() 1612 }); 1613 1614 //animate bottom holder 1615 $('.cis_popup_bottom_holder').animate({ 1616 'height': 0 1617 },600,'swing'); 1618 1619 $('.cis_popup_item').stop().fadeTo(600,0, function() { 1620 $(this).remove(); 1621 1622 //show new item 1623 cis_show_image(active_item_id); 1624 }); 1625 }; 1626 }; 1627 1628 //Popup autoplay bar //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1629 1630 function cis_popup_show_autoplay_bar() { 1631 setTimeout(function() { 1632 $('.cis_popup_autoplay_bar_holder').stop().animate({ 1633 'opacity': '0.8' 1634 },400,'swing'); 1635 },100); 1636 }; 1637 1638 function cis_popup_hide_autoplay_bar() { 1639 $('.cis_popup_autoplay_bar_holder').stop(true,false).animate({ 1640 'opacity': '0' 1641 },400,'swing'); 1642 $('.cis_popup_autoplay_bar').stop(true,false).animate({ 1643 'width': '0%' 1644 },400,'swing'); 1645 }; 1646 1647 //slider correction//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1648 $('.cis_row_item').mouseenter(function() { 1649 cis_make_slider_item_correction($(this)); 1650 }); 1651 1652 function cis_make_slider_item_correction($elem) { 1653 var $loader = $elem.find('.cis_row_item_loader'); 1654 var slider_id = $loader.parents('.cis_main_wrapper').attr("cis_slider_id"); 1655 var item_id = $loader.parents('.cis_row_item').attr("item_id"); 1656 1657 // get total items width 1658 var items_w = parseInt($loader.parents('.cis_main_wrapper').find('.cis_images_holder').width()); 1659 var total_w = parseInt($loader.parents('.cis_main_wrapper').find('.cis_images_row').width()); 1660 1661 //check if slider in scroll progress, then return 1662 if($loader.parents('.cis_main_wrapper').find('.cis_images_holder').hasClass('cis_scrolling') || $loader.parents('.cis_main_wrapper').find('.cis_images_holder').hasClass('cis_autoplay_back_animation') || items_w < total_w) 1663 return; 1664 1665 var $cis_popup = $('.cis_popup_wrapper'); 1666 1667 var loader_width = parseInt($loader.css('width')); 1668 var items_m_r = parseInt($loader.parents('.cis_row_item').css('margin-right')); 1669 1670 //get slider_offset 1671 var image_index = $loader.parents('.cis_row_item').attr("cis_item_order"); 1672 var total_items_width = 0; 1673 $loader.parents('.cis_main_wrapper').find('.cis_row_item').each(function(i) { 1674 var w = parseInt($(this).width()); 1675 var m_r = parseInt($(this).css('margin-right')); 1676 total_items_width = total_items_width + 1*w + 1*m_r; 1677 if(i == image_index) 1678 return false; 1679 }); 1680 1681 var current_left_offset = Math.abs(parseInt($loader.parents('.cis_main_wrapper').find('.cis_images_holder').css('margin-left'))); 1682 var wrapper_width = parseInt($loader.parents('.cis_main_wrapper').width()); 1683 1684 var offset1 = total_items_width - current_left_offset; 1685 var direction = 0; 1686 var item_offset_to_move = 0; 1687 if(offset1 >= wrapper_width) { 1688 var item_offset = total_items_width - current_left_offset - wrapper_width - items_m_r; 1689 var item_offset_to_move = item_offset < 0 ? 0 : item_offset; 1690 } 1691 else { 1692 if(offset1 < loader_width) { 1693 var item_offset_to_move = loader_width - offset1 + 1*items_m_r; 1694 direction = 1; 1695 } 1696 }; 1697 1698 // BUG FIX 1699 var current_left_offset_with_sign = parseInt($loader.parents('.cis_main_wrapper').find('.cis_images_holder').css('margin-left')); 1700 if(direction == 1 && item_offset_to_move > 0 && image_index == 0 && current_left_offset_with_sign >= 0) 1701 return; 1702 1703 var popup_loader_animate_timeout = 400; 1704 if(item_offset_to_move > 0) { 1705 // popup_loader_animate_timeout = Math.abs(item_offset_to_move) * 4; 1706 if(direction == 1) { 1707 $loader.parents('.cis_main_wrapper').find('.cis_images_holder').stop(true,fal
1707se).animate({ 1708 'margin-left': "+=" + item_offset_to_move 1709 },popup_loader_animate_timeout,'swing'); 1710 } 1711 else { 1712 $loader.parents('.cis_main_wrapper').find('.cis_images_holder').stop(true,false).animate({ 1713 'margin-left': "-=" + item_offset_to_move 1714 },popup_loader_animate_timeout,'swing'); 1715 }; 1716 }; 1717 }; 1718 1719 // slider autoplay/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1720 var cis_evenly_move_intervals = new Array(); 1721 var cis_autoplay_start_timeouts = new Array(); 1722 var cis_autoplay_animate_back_timeouts = new Array(); 1723 function cis_make_autoplay() { 1724 $(".cis_main_wrapper").each(function() { 1725 $wrapper = $(this); 1726 //get autoplay data 1727 var slider_data = $wrapper.find('.cis_moving_data').html(); 1728 var slider_data_array = slider_data.split(','); 1729 var slider_autoplay = parseInt(slider_data_array[3]); 1730 var slider_autoplay_start_timeout = parseInt(slider_data_array[4]); 1731 var slider_autoplay_step_timeout = parseInt(slider_data_array[5]); 1732 var slider_autoplay_evenly_speed = parseInt(slider_data_array[6]); 1733 1734 if(slider_autoplay == 0) { 1735 return; 1736 } 1737 else if(slider_autoplay == 1) { 1738 cis_make_evenly_autoplay($wrapper); 1739 } 1740 else if(slider_autoplay == 2) { 1741 cis_make_steps_autoplay($wrapper); 1742 } 1743 }); 1744 }; 1745 cis_make_autoplay(); 1746 1747 function cis_make_steps_autoplay($wrapper) { 1748 var slider_id = $wrapper.attr("roll"); 1749 1750 var slider_data = $wrapper.find('.cis_moving_data').html(); 1751 var slider_data_array = slider_data.split(','); 1752 var slider_autoplay_start_timeout = parseInt(slider_data_array[4]); 1753 var slider_autoplay_step_timeout = parseInt(slider_data_array[5]); 1754 var slider_autoplay_restart_timeout = parseInt(slider_data_array[7]); 1755 1756 cis_autoplay_animate_back_timeouts[slider_id] = ''; 1757 1758 cis_autoplay_start_timeouts[slider_id] = setTimeout(function() {//set timeout 1759 //set interval 1760 cis_evenly_move_intervals[slider_id] = setInterval(function() { 1761 cis_move_slider_by_steps($wrapper); 1762 },slider_autoplay_step_timeout); 1763 },slider_autoplay_start_timeout); 1764 1765 $wrapper.hover(function() { 1766 clearTimeout(cis_autoplay_start_timeouts[slider_id]); 1767 clearTimeout(cis_autoplay_animate_back_timeouts[slider_id]); 1768 clearInterval(cis_evenly_move_intervals[slider_id]); 1769 $wrapper.addClass('cis_mouseentered'); 1770 },function() { 1771 //check if popup vissible/////////////////////////////////// 1772 var $cis_popup = $('.cis_popup_wrapper'); 1773 var popup_slider_id = $cis_popup.attr("slider_id"); 1774 if($cis_popup.hasClass('cis_vissible') && popup_slider_id == slider_id) { 1775 return; 1776 } 1777 1778 cis_autoplay_start_timeouts[slider_id] = setTimeout(function() {//set timeout 1779 //set interval 1780 cis_evenly_move_intervals[slider_id] = setInterval(function() { 1781 cis_move_slider_by_steps($wrapper); 1782 },slider_autoplay_step_timeout); 1783 },slider_autoplay_restart_timeout); 1784 $wrapper.removeClass('cis_mouseentered'); 1785 }); 1786 }; 1787 1788 function cis_move_slider_by_steps($wrapper) { 1789 var slider_id = $wrapper.attr("roll"); 1790 1791 var slider_data = $wrapper.find('.cis_moving_data').html(); 1792 var slider_data_array = slider_data.split(','); 1793 var slider_autoplay_start_timeout = parseInt(slider_data_array[4]); 1794 var slider_autoplay_step_timeout = parseInt(slider_data_array[5]); 1795 1796 $cis_images_holder = $wrapper.find('.cis_images_holder'); 1797 var screen_w = parseFloat($cis_images_holder.parent('div').width()); 1798 var total_w = parseFloat($cis_images_holder.width()); 1799 1800 if(total_w >= screen_w) 1801 var result = cis_move_images_holder_left($cis_images_holder); 1802 else 1803 var result = cis_move_images_holder_right($cis_images_holder); 1804 1805 if(result == 'end') { 1806 clearTimeout(cis_autoplay_start_timeouts[slider_id]); 1807 clearInterval(cis_evenly_move_intervals[slider_id]); 1808 1809 var cis_animate_back_to_start_timeout = slider_autoplay_step_timeout; 1810 var cis_animate_back_to_start_time = Math.abs(parseInt((total_w - screen_w) * 1.5)); 1811 cis_animate_back_to_start_time = cis_animate_back_to_start_time < 600 ? 600 : cis_animate_back_to_start_time; 1812 1813 var $sl = $('.cis_wrapper_' + slider_id).find('.cis_images_holder');; 1814 //set timeout to animate back
1815 cis_autoplay_animate_back_timeouts[slider_id] = setTimeout(function() { 1816 $sl.addClass('cis_autoplay_back_animation'); 1817 //animate back to start 1818 $sl.stop(true,false).animate({ 1819 'margin-left': 0 1820 },cis_animate_back_to_start_time,'easeOutBack', function() { 1821 var $sl = $('.cis_wrapper_' + slider_id); 1822 $sl.find('.cis_images_holder').removeClass('cis_autoplay_back_animation'); 1823 1824 //check to see that mouseenter does not happened 1825 if($wrapper.hasClass('cis_mouseentered')) 1826 return; 1827 1828 //set new autoplay 1829 cis_autoplay_start_timeouts[slider_id] = setTimeout(function() {//set timeout 1830 //set interval 1831 cis_evenly_move_intervals[slider_id] = setInterval(function() { 1832 cis_move_slider_by_steps($sl); 1833 },slider_autoplay_step_timeout); 1834 },slider_autoplay_start_timeout); 1835 }); 1836 },cis_animate_back_to_start_timeout); 1837 1838 } 1839 }; 1840 1841 var cis_interval_time = 250; 1842 function cis_make_evenly_autoplay($wrapper) { 1843 var slider_id = $wrapper.attr("roll"); 1844 1845 var slider_data = $wrapper.find('.cis_moving_data').html(); 1846 var slider_data_array = slider_data.split(','); 1847 var slider_autoplay_start_timeout = parseInt(slider_data_array[4]); 1848 var slider_autoplay_restart_timeout = parseInt(slider_data_array[7]); 1849 1850 cis_autoplay_animate_back_timeouts[slider_id] = ''; 1851 1852 cis_autoplay_start_timeouts[slider_id] = setTimeout(function() {//set timeout 1853 //set interval 1854 cis_evenly_move_intervals[slider_id] = setInterval(function() { 1855 cis_move_slider_evenly($wrapper); 1856 },cis_interval_time); 1857 },slider_autoplay_start_timeout); 1858 1859 $wrapper.hover(function() { 1860 clearTimeout(cis_autoplay_start_timeouts[slider_id]); 1861 clearTimeout(cis_autoplay_animate_back_timeouts[slider_id]); 1862 clearInterval(cis_evenly_move_intervals[slider_id]); 1863 $wrapper.addClass('cis_mouseentered'); 1864 },function() { 1865 //check if popup vissible/////////////////////////////////// 1866 var $cis_popup = $('.cis_popup_wrapper'); 1867 var popup_slider_id = $cis_popup.attr("slider_id"); 1868 if($cis_popup.hasClass('cis_vissible') && popup_slider_id == slider_id) { 1869 return; 1870 } 1871 1872 cis_autoplay_start_timeouts[slider_id] = setTimeout(function() {//set timeout 1873 //set interval 1874 cis_evenly_move_intervals[slider_id] = setInterval(function() { 1875 cis_move_slider_evenly($wrapper); 1876 },cis_interval_time); 1877 },slider_autoplay_restart_timeout); 1878 $wrapper.removeClass('cis_mouseentered'); 1879 }); 1880 }; 1881 1882 function cis_move_slider_evenly($wrapper) { 1883 var slider_id = $wrapper.attr("roll"); 1884 1885 //get autoplay data 1886 var slider_data = $wrapper.find('.cis_moving_data').html(); 1887 var slider_data_array = slider_data.split(','); 1888 var slider_autoplay_start_timeout = parseInt(slider_data_array[4]); 1889 var slider_autoplay_evenly_speed = parseInt(slider_data_array[6]); 1890 1891 $cis_images_holder = $wrapper.find('.cis_images_holder'); 1892 var screen_w = parseFloat($cis_images_holder.parent('div').width()); 1893 var total_w = parseFloat($cis_images_holder.width()); 1894 var curr_left = parseFloat($cis_images_holder.css('margin-left')); 1895 curr_left = (total_w >= screen_w) ? curr_left - slider_autoplay_evenly_speed : curr_left + 1 *
1895slider_autoplay_evenly_speed; 1896 1897 var cis_single_autoplay_time = 400; 1898 var cis_autoplay_ease_time = 600; 1899 var cis_animate_back_to_start_timeout = 2000; 1900 var cis_animate_back_to_start_time = Math.abs(parseInt((total_w - screen_w) * 1.5)); 1901 cis_animate_back_to_start_time = cis_animate_back_to_start_time < 600 ? 600 : cis_animate_back_to_start_time; 1902 1903 var slider_data = $wrapper.find('.cis_moving_data').html(); 1904 var slider_data_array = slider_data.split(','); 1905 var delta_offset = parseInt(slider_data_array[0]); 1906 var move_speed_time = parseInt(slider_data_array[1]); 1907 var ease_effect = parseInt(slider_data_array[2]); 1908 var cis_effect_type = 'swing'; 1909 1910 ease_effect = slider_autoplay_evenly_speed; 1911 1912 if(total_w >= screen_w) { 1913 //check if end 1914 if(Math.abs(curr_left) + 1 * screen_w >= total_w) { 1915 clearTimeout(cis_autoplay_start_timeouts[slider_id]); 1916 clearInterval(cis_evenly_move_intervals[slider_id]); 1917 1918 var desired_left = screen_w - total_w; 1919 var desired_left_1 = desired_left; 1920 desired_left_1 = (total_w < screen_w) ? desired_left_1 + ease_effect * 1 : desired_left_1 - ease_effect * 1; 1921 1922 //calculate last point speed 1923 var curr_left_final = parseFloat($cis_images_holder.css('margin-left')); 1924 var move_speed_time_final = Math.abs(curr_left_final - desired_left_1) * cis_single_autoplay_time / slider_autoplay_evenly_speed; 1925 $cis_images_holder.stop(true,false).animate({//swing effect 1926 'margin-left': desired_left_1 1927 },move_speed_time_final,cis_effect_type,function() { 1928 //easing animation on end 1929 var $sl = $('.cis_wrapper_' + slider_id).find('.cis_images_holder'); 1930 $sl.stop().animate({ 1931 'margin-left': desired_left 1932 },cis_autoplay_ease_time,'easeOutBack', function() { 1933 1934 //check to see that mouseenter does not happened 1935 if($wrapper.hasClass('cis_mouseentered')) 1936 return; 1937 1938 var $sl = $('.cis_wrapper_' + slider_id).find('.cis_images_holder'); 1939 //set timeout to animate back 1940 cis_autoplay_animate_back_timeouts[slider_id] = setTimeout(function() { 1941 //animate back to start 1942 $sl.addClass('cis_autoplay_back_animation'); 1943 $sl.stop(true,false).animate({ 1944 'margin-left': 0 1945 },cis_animate_back_to_start_time,'easeOutBack', function() { 1946 var $sl = $('.cis_wrapper_' + slider_id); 1947 1948 $sl.find('.cis_images_holder').removeClass('cis_autoplay_back_animation'); 1949 //check to see that mouseenter does not happened 1950 if($wrapper.hasClass('cis_mouseentered')) 1951 return; 1952 1953 //set new autoplay 1954 cis_autoplay_start_timeouts[slider_id] = setTimeout(function() {//set timeout 1955 //set interval 1956 cis_evenly_move_intervals[slider_id] = setInterval(function() { 1957 cis_move_slider_evenly($sl); 1958 },cis_interval_time); 1959 },slider_autoplay_start_timeout); 1960 }); 1961 },cis_animate_back_to_start_timeout); 1962 }); 1963 }); 1964 } 1965 else { 1966 $cis_images_holder.stop(true,false).animate({ 1967 'margin-left': curr_left 1968 },cis_single_autoplay_time,'linear'); 1969 } 1970 } 1971 else { 1972 //check if end 1973 if(Math.abs(curr_left) + 1 * total_w >= screen_w) { 1974 //clear timeouts, intervals 1975 clearTimeout(cis_autoplay_start_timeouts[slider_id]); 1976 clearInterval(cis_evenly_move_intervals[slider_id]); 1977 1978 var desired_left = screen_w - total_w; 1979 var desired_left_1 = desired_left; 1980 desired_left_1 = desired_left_1 + ease_effect * 1; 1981 1982 //calculate last point speed 1983 var curr_left_final = parseFloat($cis_images_holder.css('margin-left')); 1984 var move_speed_time_final = Math.abs(curr_left_final - desired_left_1) * cis_single_autoplay_time / slider_autoplay_evenly_speed; 1985 $cis_images_holder.stop(true,false).animate({//swing effect 1986 'margin-left': desired_left_1 1987 },move_speed_time_final,cis_effect_type,function() { 1988 //easing animation on end 1989 var $sl = $('.cis_wrapper_' + slider_id).find('.cis_images_holder'); 1990 $sl.stop().animate({ 1991 'margin-left': desired_left 1992 }
1992,cis_autoplay_ease_time,'easeOutBack', function() { 1993 //check to see that mouseenter does not happened 1994 if($wrapper.hasClass('cis_mouseentered')) 1995 return; 1996 var $sl = $('.cis_wrapper_' + slider_id).find('.cis_images_holder'); 1997 //set timeout to animate back 1998 cis_autoplay_animate_back_timeouts[slider_id] = setTimeout(function() { 1999 //animate back to start 2000 $sl.stop(true,false).animate({ 2001 'margin-left': 0 2002 },cis_animate_back_to_start_time,'easeOutBack', function() { 2003 //check to see that mouseenter does not happened 2004 if($wrapper.hasClass('cis_mouseentered')) 2005 return; 2006 2007 var $sl = $('.cis_wrapper_' + slider_id); 2008 //set new autoplay 2009 cis_autoplay_start_timeouts[slider_id] = setTimeout(function() {//set timeout 2010 //set interval 2011 cis_evenly_move_intervals[slider_id] = setInterval(function() { 2012 cis_move_slider_evenly($sl); 2013 },cis_interval_time); 2014 },slider_autoplay_start_timeout); 2015 }); 2016 },cis_animate_back_to_start_timeout); 2017 }); 2018 }); 2019 } 2020 else { 2021 $cis_images_holder.stop(true,false).animate({ 2022 'margin-left': curr_left 2023 },cis_single_autoplay_time,'linear'); 2024 } 2025 } 2026 2027 }; 2028 2029 //arrows 2030 function cis_prepare_arrows() { 2031 $(".cis_main_wrapper").each(function() { 2032 var $wrapper = $(this); 2033 var $left_arrow = $wrapper.find('.cis_button_left'); 2034 var $right_arrow = $wrapper.find('.cis_button_right'); 2035 2036 //get arrows data 2037 var arr_data = $wrapper.find('.cis_arrow_data').html(); 2038 var arr_data_array = arr_data.split(','); 2039 var arrow_width = arr_data_array[0]; 2040 var arrow_corner_offset = arr_data_array[1]; 2041 var arrow_middle_offset = arr_data_array[2]; 2042 var arrow_opacity = arr_data_array[3] / 100; 2043 var show_arrows = arr_data_array[4]; 2044 2045 //set data 2046 $left_arrow.attr("op",arrow_opacity); 2047 $left_arrow.attr("corner_offset",arrow_corner_offset); 2048 $right_arrow.attr("op",arrow_opacity); 2049 $right_arrow.attr("corner_offset",arrow_corner_offset); 2050 2051 //set styles 2052 $left_arrow.css('width',arrow_width); 2053 $right_arrow.css('width',arrow_width); 2054 2055 var arrow_height = parseInt ($left_arrow.height()); 2056 var wrapper_height = parseFloat ($wrapper.height()); 2057 var p_t = isNaN(parseFloat($wrapper.css('padding-top'))) ? 0 : parseFloat($wrapper.css('padding-top')); 2058 var p_b = isNaN(parseFloat($wrapper.css('padding-bottom'))) ? 0 : parseFloat($wrapper.css('padding-bottom')); 2059 var arrow_top_position = ((wrapper_height + 1 * p_t + 1 * p_b - arrow_height) / 2 ) + 1 * arrow_middle_offset; 2060 2061 $left_arrow.css({ 2062 'top': arrow_top_position, 2063 'left': '-64px', 2064 'opacity': arrow_opacity 2065 }); 2066 $right_arrow.css({ 2067 'top': arrow_top_position, 2068 'right': '-64px', 2069 'opacity': arrow_opacity 2070 }); 2071 2072 if(show_arrows == 0) {//never show arrows 2073 $left_arrow.remove(); 2074 $right_arrow.remove(); 2075 } 2076 else if(show_arrows == 1) {//show on hover 2077 $wrapper.hover(function() { 2078 cis_show_arrows($wrapper); 2079 }, function() { 2080 cis_hide_arrows($wrapper); 2081 }) 2082 } 2083 else { 2084 cis_show_arrows($wrapper); 2085 } 2086 }); 2087 }; 2088 setTimeout(function() { 2089 cis_prepare_arrows(); 2090 },1200); 2091 2092 var cis_arrows_timeout1 = ''; 2093 var cis_arrows_timeout2 = ''; 2094 function cis_show_arrows($wrapper) { 2095 //clear timeouts 2096 clearTimeout(cis_arrows_timeout1); 2097 clearTimeout(cis_arrows_timeout2); 2098 2099 var $left_arrow = $wrapper.find('.cis_button_left'); 2100 var $right_arrow = $wrapper.find('.cis_button_right'); 2101 2102 var corner_offset = $left_arrow.attr("corner_offset"); 2103 2104 var animation_time = 400; 2105 var start_offset = -64; 2106 var effect = 'easeOutBack'; 2107 2108 cis_arrows_timeout1 = setTimeout(function() { 2109 $left_arrow.stop(true,false).animate({ 2110 'left': corner_offset 2111 },animation_time,effect); 2112 2113 $right_arrow.stop(true,false).animate({ 2114 'right': corner_offset 2115 },animation_time,effect); 2116 },100); 2117 2118 }; 2119 function cis_hide_arrows($wrapper) { 2120 //clear timeouts 2121 clearTimeout(cis_arrows_timeout1); 2122 clearTimeout(cis_arrows_timeout2); 2123 2124 var $left_arrow = $wrapper.find('.cis_button_left'); 2125 var $right_arrow = $wrapper.find('.cis_button_right'); 2126 2127 var animation_time = 300; 2128 var start_offset = -64; 2129 var effect = 'easeInBack'; 2130 2131 cis_arrows_timeout2 = setTimeout(function() {
2132 $left_arrow.stop(true,false).animate({ 2133 'left': start_offset 2134 },animation_time,effect); 2135 2136 $right_arrow.stop(true,false).animate({ 2137 'right': start_offset 2138 },animation_time,effect); 2139 },200) 2140 }; 2141 2142//mousewheel************************************************************** 2143 $('.cis_images_row').mousewheel(function(objEvent, intDelta) { 2144 if($(this).hasClass('cis_scrolling_vertical')) 2145 return; 2146 if(intDelta > 0) 2147 cis_move_images_holder_left($(this).find('.cis_images_holder')); 2148 else 2149 cis_move_images_holder_right($(this).find('.cis_images_holder')); 2150 }); 2151 2152 // setTimeout(function() { 2153 // //cis_move_images_holder_right($('.cis_images_holder')); 2154 // },250); 2155 2156 //function to move left 2157 2158 var cis_effect_type = 'swing'; 2159 var cis_clear_timeout = ''; 2160 var cis_switch_move_direction = false; 2161 2162 function cis_move_images_holder_left($wrapper) { 2163 2164 //get slider data 2165 var slider_data = $wrapper.parents('.cis_main_wrapper ').find('.cis_moving_data').html(); 2166 var slider_data_array = slider_data.split(','); 2167 var delta_offset = parseInt(slider_data_array[0]); 2168 var move_speed_time = parseInt(slider_data_array[1]); 2169 var ease_effect = parseInt(slider_data_array[2]); 2170 2171 clearTimeout(cis_clear_timeout); 2172 $('.cis_images_holder').addClass('cis_scrolling'); 2173 cis_clear_timeout = setTimeout(function() { 2174 $('.cis_images_holder').removeClass('cis_scrolling'); 2175 },move_speed_time); 2176 2177 var screen_w = parseFloat($wrapper.parent('div').width()); 2178 var total_w = parseFloat($wrapper.width()); 2179 var curr_left = parseFloat($wrapper.css('margin-left')); 2180 curr_left -= delta_offset; 2181 2182 //check if end 2183 if(Math.abs(curr_left) + 1 * screen_w >= total_w) { 2184 var desired_left = screen_w - total_w; 2185 var desired_left_1 = desired_left; 2186 desired_left_1 = (total_w < screen_w) ? desired_left_1 + ease_effect * 1 : desired_left_1 - ease_effect * 1; 2187 2188 if(total_w < screen_w && !cis_switch_move_direction) { 2189 cis_switch_move_direction = true; 2190 cis_move_images_holder_right($wrapper); 2191 cis_switch_move_direction = false; 2192 return; 2193 } 2194 2195 //calculate last point speed 2196 var curr_left_final = parseFloat($wrapper.css('margin-left')); 2197 var move_speed_time_final = Math.abs(curr_left_final - desired_left_1) * move_speed_time * 1.2 / delta_offset; 2198 $wrapper.stop(true,false).animate({ 2199 'margin-left': desired_left_1 2200 },move_speed_time_final,cis_effect_type,function() { 2201 $(this).stop().animate({ 2202 'margin-left': desired_left 2203 },move_speed_time,'easeOutBack') 2204 }); 2205 2206 return 'end'; 2207 } 2208 else { 2209 $wrapper.stop(true,false).animate({ 2210 'margin-left': curr_left 2211 },move_speed_time,cis_effect_type); 2212 } 2213 2214 }; 2215 function cis_move_images_holder_right($wrapper) { 2216 2217 //get slider data 2218 var slider_data = $wrapper.parents('.cis_main_wrapper ').find('.cis_moving_data').html(); 2219 var slider_data_array = slider_data.split(','); 2220 var delta_offset = parseInt(slider_data_array[0]); 2221 var move_speed_time = parseInt(slider_data_array[1]); 2222 var ease_effect = parseInt(slider_data_array[2]); 2223 2224 clearTimeout(cis_clear_timeout); 2225 $('.cis_images_holder').addClass('cis_scrolling'); 2226 cis_clear_timeout = setTimeout(function() { 2227 $('.cis_images_holder').removeClass('cis_scrolling'); 2228 },move_speed_time); 2229 2230 2231 var screen_w = parseFloat($wrapper.parent('div').width()); 2232 var total_w = parseFloat($wrapper.width()); 2233 var curr_left = parseFloat($wrapper.css('margin-left')); 2234 curr_left += delta_offset; 2235 2236 //check if start 2237 if(curr_left >= 0) { 2238 var desired_left = 0; 2239 var desired_left_1 = desired_left; 2240 desired_left_1 = (total_w < screen_w) ? desired_left_1 - ease_effect * 1 : desired_left_1 + ease_effect * 1; 2241 2242 if(total_w < screen_w && !cis_switch_move_direction) { 2243 cis_switch_move_direction = true; 2244 var r = cis_move_images_holder_left($wrapper); 2245 cis_switch_move_direction = false; 2246 return r; 2247 } 2248 2249 //calculate last point speed 2250 var curr_left_final = parseFloat($wrapper.css('margin-left')); 2251 var move_speed_time_final = Math.abs(curr_left_final - desired_left_1) * move_speed_time * 1.2 / delta_offset;
2252 $wrapper.stop(true,false).animate({ 2253 'margin-left': desired_left_1 2254 },move_speed_time_final,cis_effect_type,function() { 2255 $(this).stop().animate({ 2256 'margin-left': desired_left 2257 },move_speed_time,'easeOutBack') 2258 }); 2259 2260 return 'end'; 2261 } 2262 else { 2263 $wrapper.stop().animate({ 2264 'margin-left': curr_left 2265 },move_speed_time,cis_effect_type); 2266 } 2267 }; 2268 2269 //buttons 2270 $('.cis_button_left').click(function() { 2271 var $cis_wrapper = $(this).parents('.cis_images_row').find('.cis_images_holder'); 2272 var screen_w = parseFloat($cis_wrapper.parent('div').width()); 2273 var total_w = parseFloat($cis_wrapper.width()); 2274 if(total_w < screen_w) 2275 cis_move_images_holder_left($cis_wrapper); 2276 else 2277 cis_move_images_holder_right($cis_wrapper); 2278 }); 2279 $('.cis_button_right').click(function() { 2280 var $cis_wrapper = $(this).parents('.cis_images_row').find('.cis_images_holder'); 2281 var screen_w = parseFloat($cis_wrapper.parent('div').width()); 2282 var total_w = parseFloat($cis_wrapper.width()); 2283 if(total_w < screen_w) 2284 cis_move_images_holder_right($cis_wrapper); 2285 else 2286 cis_move_images_holder_left($cis_wrapper); 2287 }); 2288 $('.cis_button_left').hover(function() { 2289 $(this).animate({ 2290 'opacity' : 1 2291 },300); 2292 },function() { 2293 var opacity_inactive = $(this).attr("op"); 2294 $(this).animate({ 2295 'opacity' : opacity_inactive 2296 },300); 2297 }); 2298 $('.cis_button_right').hover(function() { 2299 $(this).animate({ 2300 'opacity' : 1 2301 },300); 2302 },function() { 2303 var opacity_inactive = $(this).attr("op"); 2304 $(this).animate({ 2305 'opacity' : opacity_inactive 2306 },300); 2307 }); 2308 2309 //disable page scroll 2310 $('.cis_images_row').bind('mousewheel DOMMouseScroll', function(e) { 2311 var scrollTo = null; 2312 2313 if (e.type == 'mousewheel') { 2314 scrollTo = (e.originalEvent.wheelDelta * -1); 2315 } 2316 else if (e.type == 'DOMMouseScroll') { 2317 scrollTo = 40 * e.originalEvent.detail; 2318 } 2319 2320 if (scrollTo) { 2321 e.preventDefault(); 2322 $(this).scrollTop(scrollTo + $(this).scrollTop()); 2323 } 2324 }); 2325 2326 //Items drag effect 2327 $('.cis_images_row img').on('dragstart', function(event) { event.preventDefault(); }); 2328 $('.cis_row_item_overlay').on('dragstart', function(event) { event.preventDefault(); }); 2329 2330 //Globals 2331 var cis_posXdragStart = 0, 2332 cis_currentMouseX = -1, 2333 cis_swipe_offset = 15, 2334 cis_move_interval=''; 2335 2336 $('.cis_images_row').mousemove(function(event) { 2337 cis_currentMouseX = event.pageX; 2338 }); 2339 2340 $('.cis_images_row').mousedown(function(e) { 2341 2342 //disable drag for overlay 2343 if($(e.target).hasClass('cis_row_item_overlay_txt') || $(e.target).hasClass('creative_btn') || 2344 $(e.target).hasClass('cis_row_item_overlay') || $(e.target).hasClass('creative_icon-white')) { 2345 return; 2346 } 2347 2348 cis_posXdragStart = cis_currentMouseX; 2349 var $cis_wrapper = $(this).find('.cis_images_holder'); 2350 cis_move_interval = setInterval(function() {cis_makeDrag($cis_wrapper);},10); 2351 }); 2352 2353 function cis_makeDrag($cis_wrapper) { 2354 if(cis_posXdragStart - cis_currentMouseX >= cis_swipe_offset) { 2355 cis_move_images_holder_left($cis_wrapper); 2356 cis_clear_interval(); 2357 } 2358 else if(cis_currentMouseX - cis_posXdragStart >= cis_swipe_offset) { 2359 cis_move_images_holder_right($cis_wrapper); 2360 cis_clear_interval(); 2361 } 2362 }; 2363 2364 $('.cis_images_row').mouseup(function() { 2365 cis_clear_interval(); 2366 }); 2367 $('.cis_images_row').mouseleave(function() { 2368 cis_clear_interval(); 2369 }); 2370 2371 //clear interval 2372 function cis_clear_interval() { 2373 clearInterval(cis_move_interval); 2374 }; 2375 2376 //hover animation 2377 //calculate overlay height 2378 function cis_calculate_itms_height() { 2379 $(".cis_row_item").each(function() { 2380 var $cis_overlay = $(this).find('.cis_row_item_overlay'); 2381 $cis_overlay.css({'visibility' : 'hidden','display' : 'block'}); 2382 //var h = $cis_overlay.height(); 2383 //$cis_overlay.css({'visibility' : 'visible','display' : 'block','height' : '0'}).attr('h',h); 2384 }); 2385 }; 2386 2387 $(".cis_row_item img").load(function() { 2388 var $this = $(this); 2389 $this.attr('cis_loaded','loaded');
2390 var $cis_overlay = $(this).next('.cis_row_item_overlay'); 2391 $cis_overlay.css({'visibility' : 'hidden','display' : 'block'}); 2392 var h = $cis_overlay.height(); 2393 $cis_overlay.css({'visibility' : 'visible','display' : 'block','height' : '0'}).attr('h',h); 2394 $cis_overlay.attr('cis_animation','enabled'); 2395 2396 $this.addClass('cis_loaded'); 2397 setTimeout(function() { 2398 cis_make_proccess($this); 2399 },400); 2400 }); 2401 2402 function cis_make_proccess($el) { 2403 var item_width = $el.width(); 2404 $el.parents('.cis_row_item').find('.cis_row_item_loader').animate({ 2405 width: item_width 2406 },400,'swing',function() { 2407 $el.parents('.cis_row_item').find('.cis_row_item_loader').fadeOut(200,function() { 2408 $el.parents('.cis_row_item_inner').hide().removeClass('cis_row_hidden_element').fadeIn(200); 2409 }); 2410 }); 2411 }; 2412 2413 function cis_getRandomArbitary (min, max) { 2414 return Math.random() * (max - min) + min; 2415 }; 2416 2417 function cis_calculate_loaders_width() { 2418 $('.cis_images_holder').each(function() { 2419 var $wrapper = $(this); 2420 var wrapper_width = $wrapper.parents('.cis_images_row').width(); 2421 var items_height = $wrapper.find('.cis_row_item_loader').height(); 2422 2423 var loader_prepared_width = items_height * 1.5; 2424 var loader_ratio_sign = Math.random() < 0.5 ? 1 : -1; 2425 $wrapper.find('.cis_row_item_loader').each(function() { 2426 var loader_width_calculated = loader_prepared_width + loader_ratio_sign * cis_getRandomArbitary(0,20); 2427 $(this).width(loader_width_calculated); 2428 loader_ratio_sign = loader_ratio_sign == 1 ? -1 : 1; 2429 }); 2430 }); 2431 }; 2432 cis_calculate_loaders_width(); 2433 2434 //overlay functions 2435 $('.cis_main_wrapper').each(function() { 2436 var $this = $(this); 2437 var cis_overlay_type = parseInt($(this).attr("cis_overlay_type")); 2438 if(cis_overlay_type == 0) { // slide-up on hover 2439 2440 $this.find(".cis_row_item").hover(function() { 2441 var animation_enabled = $(this).find('.cis_row_item_overlay').attr('cis_animation'); 2442 if(animation_enabled != 'enabled') 2443 return; 2444 2445 if(!($(this).parents('.cis_images_holder').hasClass('cis_scrolling'))) { 2446 var $cis_overlay = $(this).find('.cis_row_item_overlay'); 2447 var overlay_height = parseInt($cis_overlay.attr('h')); 2448 $cis_overlay.stop().animate({ 2449 height: overlay_height 2450 },300,'swing'); 2451 } 2452 },function() { 2453 var animation_enabled = $(this).find('.cis_row_item_overlay').attr('cis_animation'); 2454 if(animation_enabled != 'enabled') 2455 return; 2456 2457 var $cis_overlay = $(this).find('.cis_row_item_overlay'); 2458 $cis_overlay.stop().animate({ 2459 height: 0 2460 },300,'swing'); 2461 }); 2462 } 2463 else if(cis_overlay_type == 1) { // keep opened 2464 $this.find(".cis_row_item_overlay").addClass("cis_height_auto"); 2465 } 2466 else if(cis_overlay_type == 2) { // special animation 2467 // TODO!!! 2468 } 2469 }); 2470 2471 //make back 2472 function cis_make_backlinks() { 2473 $('.cis_main_wrapper').each(function() { 2474 var cis_back_htm = '<div style="display: block !important;z-index: 99;font-weight: normal;padding: 3px 10px 3px 8px;line-height: 20px;background-color: #000;color: #fff;position: absolute;right: 0px;font-style: italic;font-size: 12px;border-bottom-left-radius: 4px;border-bottom-right-radius: 4px;bottom: 0px;opacity: 0;background-image: linear-gradient(to bottom,#000000,#383838) !important;text-shadow: 0 3px 3px #000000;border: 1px solid rgb(0, 0, 0);border-top: 0;">By <a style="font-weight: bold;color: rgb(72, 108, 253);" href="http://creative-solutions.net/joomla/creative-image-slider" target="_blank">Creative Image Slider</a></div>'; 2475 $(this).append(cis_back_htm); 2476 var $back = $(this).children('div').last(); 2477 var h = parseInt($back.height()) + 7*1; 2478 $back.attr('h',h); 2479 2480 $(this).hover(function() { 2481 cis_show_back_canvas($back); 2482 },function() { 2483 cis_hide_back_canvas($back); 2484 }) 2485 }); 2486 }; 2487 setTimeout(function() { 2488 cis_make_backlinks(); 2489 },1200); 2490 function cis_show_back_canvas($back) { 2491 var h = -1* parseInt($back.attr('h')); 2492 $back.stop(true,false).animate({ 2493 'bottom': h, 2494 'opacity': '0.95' 2495 },'swing'); 2496 }; 2497 function cis_hide_back_canvas($back) {
2498 $back.stop(true,false).animate({ 2499 'bottom': '0', 2500 'opacity': '0' 2501 },'swing'); 2502 }; 2503 2504 2505}); 2506})(creativeJ);
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.