1/** 2Autor: megagroup.ru a.h. 3 4*/ 5 6(function( $ ){ 7 8 $.fn.megaSlider = function( options ) { 9 10 // СоздаÑм наÑÑÑойки по-ÑмолÑаниÑ, ÑаÑÑиÑÑÑ Ð¸Ñ Ñ Ð¿Ð¾Ð¼Ð¾ÑÑÑ Ð¿Ð°ÑамеÑÑов, коÑоÑÑе бÑли пеÑÐµÐ´Ð°Ð½Ñ 11 var settings = $.extend( { 12 'nav' : true, // в smarty 13 'bullets' : true, // в smarty 14 'bulletposition' : 'bottom-right', 15 'player' : true, // в smarty 16 'autoplay' : true, 17 'cycle' : true, //* 18 'start' : 0, 19 'save' : false, //* 20 'animation' : "random", 21 'interval' : 2000, 22 'speed' : 500, 23 'textanimation' : 'fade', 24 'textspeed' : 300, 25 'textposition' : 'bottom', 26 'thumbnails' : false, // в smarty 27 'autohide' : true, //* 28 'hideanimation' : 'fade', //* 29 'slicecount' : 20, 30 'onBeforeTextAnimation' : null, //* 31 'onAfterTextAnimation' : null, //* 32 'onBeforeImageAnimation' : null, //* 33 'onAfterImageAnimation' : null, //* 34 'onChangeSlide' : null 35 }, options); 36 return this.each(function() { 37 var 38 $this = $(this), 39 attrClass = this.className.split(" ")[0], 40 $items = $this.find('.' + attrClass + '-items'), 41 $itemsInner = $this.find('.' + attrClass + '-items-inner'), 42 $item = $this.find('.' + attrClass + '-item'), 43 $texts = $this.find('.' + attrClass + '-text'), 44 $images = $this.find('.' + attrClass + '-image'), 45 $prev = $this.find('.' + attrClass + '-prev'), 46 $next = $this.find('.' + attrClass + '-next'), 47 $player = $this.find('.' + attrClass + '-player'), 48 $bullets = $this.find('.' + attrClass + '-bullets'); 49 var inter, 50 rand = !!(settings.animation.indexOf('random')+1), 51 animations = (function(){ 52 var arr = []; 53 54 for (var i = 0; i < settings.animation.split(' ').length; i++) { 55 if (settings.animation.split(' ')[i] != 'random') arr.push(settings.animation.split(' ')[i]); 56 } 57 return arr; 58 })(); 59 $this.data( 'options', { 60 current : settings.start, 61 nextAnimation : 0 62 63 }); 64 $item.each(function(index, element) { 65 $(this).data('options', { 66 image : $(this).find('.' + attrClass + '-image img').attr('src') 67 }) 68 }); 69 $item.hide(); 70 $item.eq(settings.start).show(); 71 $texts.each(function(index, element){ 72 $(this).addClass(attrClass + '-text-' + settings.textposition); 73 }); 74 $bullets.addClass(attrClass + '-bullets-' + settings.bulletposition); 75 76 var now_animated = false; 77 78 var 79 animationTypes = { 80 fade : function(ind){ 81 if (ind != $this.data( 'options' ).current) { 82 now_animated = true; 83 stopAnimation(); 84 var current = $item.eq($this.data( 'options' ).current); 85 var current_text = current.find('.' + attrClass + '-text'); 86 var current_image = current.find('.' + attrClass + '-image'); 87 var next = $item.eq(ind); 88 var next_text = next.find('.' + attrClass + '-text'); 89 var next_image = next.find('.' + attrClass + '-image'); 90 91 var current_image_backup = current_image.html(); 92 var next_image_backup = next_image.html(); 93 94 95 current_image.html('<img src="' + current.data('options').image + '" />'); 96 next_image.html('<img src="' + next.data('options').image + '" />'); 97 current.removeAttr('style'); 98 current.css({ 99 'z-index' : 200 100 }).show(); 101 next.removeAttr('style'); 102 next.show().css({ 103 'z-index' : 100 104 }); 105 animateText(settings.textanimation,current_text,'setCurrent'); 106 animateText(settings.textanimation,next_text,'setNext'); 107 if (current_text.length) { 108 if (settings.onBeforeTextAnimation) settings.onBeforeTextAnimation(); 109 animateText (settings.textanimation,current_text,'hide',function(){ 110 if (settings.onBeforeImageAnimation) settings.onBeforeImageAnimation(); 111 current_image.fadeOut(settings.speed,function () { 112 current.hide(); 113 current_image.show(); 114 if (settings.onAfterImageAnimation) settings.onAfterImageAnimation(); 115 if (next_text.length) {
116 animateText (settings.textanimation,next_text,'show',function(){ 117 if (settings.onAfterTextAnimation) settings.onAfterTextAnimation(); 118 $this.data( 'options', { 119 current : ind, 120 nextAnimation : $this.data( 'options' ).nextAnimation 121 122 }); 123 current_image.html(current_image_backup); 124 next_image.html(next_image_backup); 125 continueAnimation(); 126 if (settings.onChangeSlide) settings.onChangeSlide(); 127 }); 128 } else { 129 $this.data( 'options', { 130 current : ind, 131 nextAnimation : $this.data( 'options' ).nextAnimation 132 133 }); 134 current_image.html(current_image_backup); 135 next_image.html(next_image_backup); 136 continueAnimation(); 137 if (settings.onChangeSlide) settings.onChangeSlide(); 138 } 139 }); 140 }) 141 } else { 142 if (settings.onBeforeImageAnimation) settings.onBeforeImageAnimation(); 143 current_image.fadeOut(settings.speed,function () { 144 current.hide(); 145 current_image.show(); 146 if (settings.onAfterImageAnimation) settings.onAfterImageAnimation(); 147 if (next_text.length) { 148 animateText (settings.textanimation,next_text,'show',function(){ 149 if (settings.onAfterTextAnimation) settings.onAfterTextAnimation(); 150 $this.data( 'options', { 151 current : ind, 152 nextAnimation : $this.data( 'options' ).nextAnimation 153 154 }); 155 current_image.html(current_image_backup); 156 next_image.html(next_image_backup); 157 continueAnimation(); 158 if (settings.onChangeSlide) settings.onChangeSlide(); 159 }); 160 } else { 161 $this.data( 'options', { 162 current : ind, 163 nextAnimation : $this.data( 'options' ).nextAnimation 164 165 }); 166 current_image.html(current_image_backup); 167 next_image.html(next_image_backup); 168 continueAnimation(); 169 if (settings.onChangeSlide) settings.onChangeSlide(); 170 } 171 }); 172 } 173 } 174 }, 175 slideLeft : function (ind) { 176 177 if (ind != $this.data( 'options' ).current) { 178 now_animated = true; 179 stopAnimation(); 180 var current = $item.eq($this.data( 'options' ).current); 181 var current_text = current.find('.' + attrClass + '-text'); 182 var current_image = current.find('.' + attrClass + '-image'); 183 var next = $item.eq(ind); 184 var next_text = next.find('.' + attrClass + '-text'); 185 var next_image = next.find('.' + attrClass + '-image'); 186 187 var current_image_backup = current_image.html(); 188 var next_image_backup = next_image.html(); 189 190 current_image.html('<img src="' + current.data('options').image + '" />'); 191 next_image.html('<img src="' + next.data('options').image + '" />'); 192 current.removeAttr('style'); 193 current.css({ 194 'z-index' : 200, 195 'right' : 'auto' 196 }).show(); 197 next.removeAttr('style'); 198 next.css({ 199 'z-index' : 100, 200 'left' : next.outerWidth(), 201 'right' : 'auto' 202 }).show(); 203 animateText(settings.textanimation,current_text,'setCurrent'); 204 animateText(settings.textanimation,next_text,'setNext'); 205 if (current_text.length) { 206 if (settings.onBeforeTextAnimation) settings.onBeforeTextAnimation(); 207 animateText (settings.textanimation,current_text,'hide',function(){ 208 if (settings.onBeforeImageAnimation) settings.onBeforeImageAnimation(); 209 current.animate({ 210 'left' : - current.outerWidth() 211 },settings.speed,function () { 212 current.hide(); 213 }); 214 next.animate({ 215 'left' : 0 216 },settings.speed,function () { 217 if (settings.onAfterImageAnimation) settings.onAfterImageAnimation(); 218 if (next_text.length) { 219 220 animateText (settings.textanimation,next_text,'show',function(){ 221 if (settings.onAfterTextAnimation) settings.onAfterTextAnimation(); 222 $this.data( 'options', { 223 current : ind, 224 nextAnimation : $this.data( 'options' ).nextAnimation 225 226 }); 227 current_image.html(current_image_backup); 228 next_image.html(next_image_backup); 229 continueAnimation(); 230 if (settings.onChangeSlide) settings.onChangeSlide(); 231 }); 232 } else { 233 $this.data( 'options', { 234 current : ind, 235 nextAnimation : $this.data( 'options' ).nextAnimation 236 237 }); 238 current_image.html(current_image_backup); 239 next_image.html(next_image_backup); 240 continueAnimation(); 241 if (settings.onChangeSlide) settings.onChangeSlide(); 242 } 243 }); 244 }) 245 } else { 246 if (settings.onBeforeImageAnimation) settings.onBeforeImageAnimation(); 247 current.animate({ 248 'left' : - current.outerWidth() 249 },settings.speed,function () { 250 current.hide(); 251 }); 252 next.animate({ 253 'left' : 0 254 },settings.speed,function () { 255 if (settings.onAfterImageAnimation) settings.onAfterImageAnimation(); 256 if (next_text.length) {
257 animateText (settings.textanimation,next_text,'show',function(){ 258 if (settings.onAfterTextAnimation) settings.onAfterTextAnimation(); 259 $this.data( 'options', { 260 current : ind, 261 nextAnimation : $this.data( 'options' ).nextAnimation 262 263 }); 264 current_image.html(current_image_backup); 265 next_image.html(next_image_backup); 266 continueAnimation(); 267 if (settings.onChangeSlide) settings.onChangeSlide(); 268 }); 269 } else { 270 $this.data( 'options', { 271 current : ind, 272 nextAnimation : $this.data( 'options' ).nextAnimation 273 274 }); 275 current_image.html(current_image_backup); 276 next_image.html(next_image_backup); 277 continueAnimation(); 278 if (settings.onChangeSlide) settings.onChangeSlide(); 279 } 280 }); 281 } 282 } 283 }, 284 slideRight : function (ind) { 285 286 if (ind != $this.data( 'options' ).current) { 287 now_animated = true; 288 stopAnimation(); 289 var current = $item.eq($this.data( 'options' ).current); 290 var current_text = current.find('.' + attrClass + '-text'); 291 var current_image = current.find('.' + attrClass + '-image'); 292 var next = $item.eq(ind); 293 var next_text = next.find('.' + attrClass + '-text'); 294 var next_image = next.find('.' + attrClass + '-image'); 295 var current_image_backup = current_image.html(); 296 var next_image_backup = next_image.html(); 297 298 current_image.html('<img src="' + current.data('options').image + '" />'); 299 next_image.html('<img src="' + next.data('options').image + '" />'); 300 current.removeAttr('style'); 301 current.css({ 302 'z-index' : 200, 303 'left' : 'auto' 304 }).show(); 305 next.removeAttr('style'); 306 next.css({ 307 'z-index' : 100, 308 'right' : next.outerWidth(), 309 'left' : 'auto' 310 }).show(); 311 animateText(settings.textanimation,current_text,'setCurrent'); 312 animateText(settings.textanimation,next_text,'setNext'); 313 if (current_text.length) { 314 if (settings.onBeforeTextAnimation) settings.onBeforeTextAnimation(); 315 animateText (settings.textanimation,current_text,'hide',function(){ 316 if (settings.onBeforeImageAnimation) settings.onBeforeImageAnimation(); 317 current.animate({ 318 'right' : - current.outerWidth() 319 },settings.speed,function () { 320 current.hide(); 321 }); 322 next.animate({ 323 'right' : 0 324 },settings.speed,function () { 325 if (settings.onAfterImageAnimation) settings.onAfterImageAnimation(); 326 if (next_text.length) { 327 animateText (settings.textanimation,next_text,'show',function(){ 328 if (settings.onAfterTextAnimation) settings.onAfterTextAnimation(); 329 $this.data( 'options', { 330 current : ind, 331 nextAnimation : $this.data( 'options' ).nextAnimation 332 333 }); 334 current_image.html(current_image_backup); 335 next_image.html(next_image_backup); 336 continueAnimation(); 337 if (settings.onChangeSlide) settings.onChangeSlide(); 338 }); 339 } else { 340 $this.data( 'options', { 341 current : ind, 342 nextAnimation : $this.data( 'options' ).nextAnimation 343 344 }); 345 current_image.html(current_image_backup); 346 next_image.html(next_image_backup); 347 continueAnimation(); 348 if (settings.onChangeSlide) settings.onChangeSlide(); 349 } 350 }); 351 }) 352 } else { 353 if (settings.onBeforeImageAnimation) settings.onBeforeImageAnimation(); 354 current.animate({ 355 'right' : - current.outerWidth() 356 },settings.speed,function () { 357 current.hide(); 358 }); 359 next.animate({ 360 'right' : 0 361 },settings.speed,function () { 362 if (settings.onAfterImageAnimation) settings.onAfterImageAnimation(); 363 if (next_text.length) {
364 animateText (settings.textanimation,next_text,'show',function(){ 365 if (settings.onAfterTextAnimation) settings.onAfterTextAnimation(); 366 $this.data( 'options', { 367 current : ind, 368 nextAnimation : $this.data( 'options' ).nextAnimation 369 370 }); 371 current_image.html(current_image_backup); 372 next_image.html(next_image_backup); 373 continueAnimation(); 374 if (settings.onChangeSlide) settings.onChangeSlide(); 375 }); 376 } else { 377 $this.data( 'options', { 378 current : ind, 379 nextAnimation : $this.data( 'options' ).nextAnimation 380 381 }); 382 current_image.html(current_image_backup); 383 next_image.html(next_image_backup); 384 continueAnimation(); 385 if (settings.onChangeSlide) settings.onChangeSlide(); 386 } 387 }); 388 } 389 } 390 }, 391 slideTop : function (ind) { 392 if (ind != $this.data( 'options' ).current) { 393 now_animated = true; 394 stopAnimation(); 395 var current = $item.eq($this.data( 'options' ).current); 396 var current_text = current.find('.' + attrClass + '-text'); 397 var current_image = current.find('.' + attrClass + '-image'); 398 var next = $item.eq(ind); 399 var next_text = next.find('.' + attrClass + '-text'); 400 var next_image = next.find('.' + attrClass + '-image'); 401 var current_image_backup = current_image.html(); 402 var next_image_backup = next_image.html(); 403 404 current_image.html('<img src="' + current.data('options').image + '" />'); 405 next_image.html('<img src="' + next.data('options').image + '" />'); 406 current.removeAttr('style'); 407 current.css({ 408 'z-index' : 200, 409 'top' : 0 410 }).show(); 411 next.removeAttr('style'); 412 next.css({ 413 'z-index' : 100, 414 'top' : next.outerHeight() 415 }).show(); 416 animateText(settings.textanimation,current_text,'setCurrent'); 417 animateText(settings.textanimation,next_text,'setNext'); 418 if (current_text.length) { 419 if (settings.onBeforeTextAnimation) settings.onBeforeTextAnimation(); 420 animateText (settings.textanimation,current_text,'hide',function(){ 421 if (settings.onBeforeImageAnimation) settings.onBeforeImageAnimation(); 422 current.animate({ 423 'top' : -current.outerHeight() 424 },settings.speed,function () { 425 current.hide(); 426 }); 427 next.animate({ 428 'top' : 0 429 },settings.speed,function () { 430 if (settings.onAfterImageAnimation) settings.onAfterImageAnimation(); 431 if (next_text.length) { 432 animateText (settings.textanimation,next_text,'show',function(){ 433 if (settings.onAfterTextAnimation) settings.onAfterTextAnimation(); 434 $this.data( 'options', { 435 current : ind, 436 nextAnimation : $this.data( 'options' ).nextAnimation 437 438 }); 439 current_image.html(current_image_backup); 440 next_image.html(next_image_backup); 441 continueAnimation(); 442 if (settings.onChangeSlide) settings.onChangeSlide(); 443 }); 444 } else { 445 $this.data( 'options', { 446 current : ind, 447 nextAnimation : $this.data( 'options' ).nextAnimation 448 449 }); 450 current_image.html(current_image_backup); 451 next_image.html(next_image_backup); 452 continueAnimation(); 453 if (settings.onChangeSlide) settings.onChangeSlide(); 454 } 455 }); 456 }) 457 } else { 458 if (settings.onBeforeImageAnimation) settings.onBeforeImageAnimation(); 459 current.animate({ 460 'top' : -current.outerHeight() 461 },settings.speed,function () { 462 current.hide(); 463 }); 464 next.animate({ 465 'top' : 0 466 },settings.speed,function () { 467 if (settings.onAfterImageAnimation) settings.onAfterImageAnimation(); 468 if (next_text.length) {
469 animateText (settings.textanimation,next_text,'show',function(){ 470 if (settings.onAfterTextAnimation) settings.onAfterTextAnimation(); 471 $this.data( 'options', { 472 current : ind, 473 nextAnimation : $this.data( 'options' ).nextAnimation 474 475 }); 476 current_image.html(current_image_backup); 477 next_image.html(next_image_backup); 478 continueAnimation(); 479 if (settings.onChangeSlide) settings.onChangeSlide(); 480 }); 481 } else { 482 $this.data( 'options', { 483 current : ind, 484 nextAnimation : $this.data( 'options' ).nextAnimation 485 486 }); 487 current_image.html(current_image_backup); 488 next_image.html(next_image_backup); 489 continueAnimation(); 490 if (settings.onChangeSlide) settings.onChangeSlide(); 491 } 492 }); 493 } 494 } 495 }, 496 slideBottom : function (ind) { 497 if (ind != $this.data( 'options' ).current) { 498 now_animated = true; 499 stopAnimation(); 500 var current = $item.eq($this.data( 'options' ).current); 501 var current_text = current.find('.' + attrClass + '-text'); 502 var current_image = current.find('.' + attrClass + '-image'); 503 var next = $item.eq(ind); 504 var next_text = next.find('.' + attrClass + '-text'); 505 var next_image = next.find('.' + attrClass + '-image'); 506 var current_image_backup = current_image.html(); 507 var next_image_backup = next_image.html(); 508 509 current_image.html('<img src="' + current.data('options').image + '" />'); 510 next_image.html('<img src="' + next.data('options').image + '" />'); 511 current.removeAttr('style'); 512 current.css({ 513 'z-index' : 200, 514 'top' : 0, 515 'bottom' : 'auto' 516 }).show(); 517 next.removeAttr('style'); 518 next.css({ 519 'z-index' : 100, 520 'top' : -next.outerHeight(), 521 'bottom' : 'auto' 522 }).show(); 523 animateText(settings.textanimation,current_text,'setCurrent'); 524 animateText(settings.textanimation,next_text,'setNext'); 525 if (current_text.length) { 526 if (settings.onBeforeTextAnimation) settings.onBeforeTextAnimation(); 527 animateText (settings.textanimation,current_text,'hide',function(){ 528 if (settings.onBeforeImageAnimation) settings.onBeforeImageAnimation(); 529 current.animate({ 530 'top' : current.outerHeight() 531 },settings.speed,function () { 532 current.hide(); 533 }); 534 next.animate({ 535 'top' : 0 536 },settings.speed,function () { 537 if (settings.onAfterImageAnimation) settings.onAfterImageAnimation(); 538 if (next_text.length) { 539 animateText (settings.textanimation,next_text,'show',function(){ 540 if (settings.onAfterTextAnimation) settings.onAfterTextAnimation(); 541 $this.data( 'options', { 542 current : ind, 543 nextAnimation : $this.data( 'options' ).nextAnimation 544 545 }); 546 current_image.html(current_image_backup); 547 next_image.html(next_image_backup); 548 continueAnimation(); 549 if (settings.onChangeSlide) settings.onChangeSlide(); 550 }); 551 } else { 552 $this.data( 'options', { 553 current : ind, 554 nextAnimation : $this.data( 'options' ).nextAnimation 555 556 }); 557 current_image.html(current_image_backup); 558 next_image.html(next_image_backup); 559 continueAnimation(); 560 if (settings.onChangeSlide) settings.onChangeSlide(); 561 } 562 }); 563 }) 564 } else { 565 if (settings.onBeforeImageAnimation) settings.onBeforeImageAnimation(); 566 current.animate({ 567 'top' : current.outerHeight() 568 },settings.speed,function () { 569 current.hide(); 570 }); 571 next.animate({ 572 'top' : 0 573 },settings.speed,function () { 574 if (settings.onAfterImageAnimation) settings.onAfterImageAnimation(); 575 if (next_text.length) {
576 animateText (settings.textanimation,next_text,'show',function(){ 577 if (settings.onAfterTextAnimation) settings.onAfterTextAnimation(); 578 $this.data( 'options', { 579 current : ind, 580 nextAnimation : $this.data( 'options' ).nextAnimation 581 582 }); 583 current_image.html(current_image_backup); 584 next_image.html(next_image_backup); 585 continueAnimation(); 586 if (settings.onChangeSlide) settings.onChangeSlide(); 587 }); 588 } else { 589 $this.data( 'options', { 590 current : ind, 591 nextAnimation : $this.data( 'options' ).nextAnimation 592 593 }); 594 current_image.html(current_image_backup); 595 next_image.html(next_image_backup); 596 continueAnimation(); 597 if (settings.onChangeSlide) settings.onChangeSlide(); 598 } 599 }); 600 } 601 } 602 }, 603 sliceUp : function(ind){ 604 if (ind != $this.data( 'options' ).current) { 605 now_animated = true; 606 stopAnimation(); 607 var current = $item.eq($this.data( 'options' ).current); 608 var current_text = current.find('.' + attrClass + '-text'); 609 var current_image = current.find('.' + attrClass + '-image'); 610 var next = $item.eq(ind); 611 var next_text = next.find('.' + attrClass + '-text'); 612 var next_image = next.find('.' + attrClass + '-image'); 613 614 var current_image_backup = current_image.html(); 615 var next_image_backup = next_image.html(); 616 617 current_image.html(function(){ 618 var html = ''; 619 var count = Math.floor(settings.slicecount / 2); 620 var sizes = [Math.ceil(current.width()/settings.slicecount),Math.ceil(current.height())]; 621 for(var i = 0; i < settings.slicecount; i++) { 622 html += '<div class="' + (i%2?attrClass + '-totop':attrClass + '-tobot') + '" style="width:' + sizes[0] +'px; height:' + sizes[1] + 'px; background:url(' + current.data('options').image + ') ' + (-sizes[0]*i) + 'px 0 no-repeat; position:absolute; top:0; left:' + (sizes[0]*i) + 'px;"></div>'; 623 } 624 return html; 625 }); 626 next_image.html(function(){ 627 var html = ''; 628 var count = Math.floor(settings.slicecount / 2); 629 var sizes = [Math.ceil(next.width()/settings.slicecount),Math.ceil(next.height())]; 630 for(var i = 0; i < settings.slicecount; i++) { 631 html += '<div class="' + (i%2?attrClass + '-totop':attrClass + '-tobot') + '" style="width:' + sizes[0] +'px; height:' + sizes[1] + 'px; background:url(' + next.data('options').image + ') ' + (-sizes[0]*i) + 'px 0 no-repeat; position:absolute; top:0; left:' + (sizes[0]*i) + 'px;"></div>'; 632 } 633 return html; 634 }); 635 current.removeAttr('style'); 636 current.css({ 637 'z-index' : 200 638 }).show(); 639 next.removeAttr('style'); 640 next.show().css({ 641 'z-index' : 100 642 }); 643 next_image.find('.' + attrClass + '-totop').css({ 644 top : next.height() 645 }); 646 next_image.find('.' + attrClass + '-tobot').css({ 647 top : -next.height() 648 }); 649 animateText(settings.textanimation,current_text,'setCurrent'); 650 animateText(settings.textanimation,next_text,'setNext'); 651 if (current_text.length) { 652 if (settings.onBeforeTextAnimation) settings.onBeforeTextAnimation(); 653 animateText (settings.textanimation,current_text,'hide',function(){ 654 if (settings.onBeforeImageAnimation) settings.onBeforeImageAnimation(); 655 current_image.find('>.slider-tobot').animate({ 656 'top' : current.height() 657 },settings.speed); 658 current_image.find('>.slider-totop').animate({ 659 'top' : -current.height() 660 },settings.speed); 661 next_image.find('>*').animate({ 662 'top' : 0 663 },settings.speed,function(){ 664 next_image.html('<img src="' + next.data('options').image + '" />'); 665 }); 666 window.setTimeout(function(){ 667 current.hide(); 668 current_image.html('<img src="' + current.data('options').image + '" />'); 669 if (settings.onAfterImageAnimation) settings.onAfterImageAnimation(); 670 if (next_text.length) {
671 animateText (settings.textanimation,next_text,'show',function(){ 672 if (settings.onAfterTextAnimation) settings.onAfterTextAnimation(); 673 $this.data( 'options', { 674 current : ind, 675 nextAnimation : $this.data( 'options' ).nextAnimation 676 677 }); 678 current_image.html(current_image_backup); 679 next_image.html(next_image_backup); 680 continueAnimation(); 681 if (settings.onChangeSlide) settings.onChangeSlide(); 682 }); 683 } else { 684 $this.data( 'options', { 685 current : ind, 686 nextAnimation : $this.data( 'options' ).nextAnimation 687 688 }); 689 current_image.html(current_image_backup); 690 next_image.html(next_image_backup); 691 continueAnimation(); 692 if (settings.onChangeSlide) settings.onChangeSlide(); 693 } 694 },settings.speed); 695 }) 696 } else { 697 if (settings.onBeforeImageAnimation) settings.onBeforeImageAnimation(); 698 current_image.find('>.slider-tobot').animate({ 699 'top' : current.height() 700 },settings.speed); 701 current_image.find('>.slider-totop').animate({ 702 'top' : -current.height() 703 },settings.speed); 704 next_image.find('>*').animate({ 705 'top' : 0 706 },settings.speed,function(){ 707 next_image.html('<img src="' + next.data('options').image + '" />'); 708 }); 709 window.setTimeout(function(){ 710 current.hide(); 711 current_image.html('<img src="' + current.data('options').image + '" />'); 712 if (settings.onAfterImageAnimation) settings.onAfterImageAnimation(); 713 if (next_text.length) { 714 animateText (settings.textanimation,next_text,'show',function(){ 715 if (settings.onAfterTextAnimation) settings.onAfterTextAnimation(); 716 $this.data( 'options', { 717 current : ind, 718 nextAnimation : $this.data( 'options' ).nextAnimation 719 720 }); 721 current_image.html(current_image_backup); 722 next_image.html(next_image_backup); 723 continueAnimation(); 724 if (settings.onChangeSlide) settings.onChangeSlide(); 725 }); 726 } else { 727 $this.data( 'options', { 728 current : ind, 729 nextAnimation : $this.data( 'options' ).nextAnimation 730 731 }); 732 current_image.html(current_image_backup); 733 next_image.html(next_image_backup); 734 continueAnimation(); 735 if (settings.onChangeSlide) settings.onChangeSlide(); 736 } 737 },settings.speed); 738 } 739 } 740 } 741 }; 742 var 743 textAnimationTypes = { 744 fade : function(ob,key,f){ 745 if (key == 'show'){ 746 ob.fadeIn(settings.textspeed,function(){ 747 if(f) f(); 748 }) 749 } else if (key == 'hide') { 750 ob.fadeOut(settings.textspeed,function(){ 751 if(f) f(); 752 }) 753 } else if (key == 'setCurrent') { 754 ob.removeAttr('style'); 755 } else if (key == 'setNext') { 756 ob.hide(); 757 } 758 }, 759 slide : function (ob,key,f) { 760 switch (settings.textposition) { 761 case "bottom" : { 762 if (key == 'show'){ 763 ob.animate({ 'bottom' : 0 },settings.textspeed,function(){ 764 if(f) f(); 765 }) 766 } else if (key == 'hide') { 767 ob.animate({ 'bottom' : -ob.outerHeight() },settings.textspeed,function(){ 768 if(f) f(); 769 }) 770 } else if (key == 'setCurrent') { 771 ob.removeAttr('style'); 772 } else if (key == 'setNext') { 773 ob.css({ 'bottom' : -ob.outerHeight() }); 774 } 775 break; 776 }; 777 case "top" : { 778 if (key == 'show'){ 779 ob.animate({ 'top' : 0 },settings.textspeed,function(){ 780 if(f) f(); 781 }) 782 } else if (key == 'hide') { 783 ob.animate({ 'top' : -ob.outerHeight() },settings.textspeed,function(){ 784 if(f) f(); 785 }) 786 } else if (key == 'setCurrent') { 787 ob.removeAttr('style'); 788 } else if (key == 'setNext') { 789 ob.css({ 'top' : -ob.outerHeight() }); 790 } 791 break; 792 } 793 case "left" : { 794 if (key == 'show'){ 795 ob.animate({ 'left' : 0 },settings.textspeed,function(){ 796 if(f) f(); 797 }) 798 } else if (key == 'hide') { 799 ob.animate({ 'left' : -ob.outerWidth() },settings.textspeed,function(){ 800 if(f) f(); 801 }) 802 } else if (key == 'setCurrent') { 803 ob.removeAttr('style'); 804 } else if (key == 'setNext') { 805 ob.css({ 'left' : -ob.outerWidth() }); 806 } 807 break; 808 } 809 case "right" : { 810 if (key == 'show'){ 811 ob.animate({ 'right' : 0 },settings.textspeed,function(){ 812 if(f) f(); 813 }) 814 } else if (key == 'hide') { 815 ob.animate({ 'right' : -ob.outerWidth() },settings.textspeed,function(){ 816 if(f) f(); 817 }) 818 } else if (key == 'setCurrent') { 819 ob.removeAttr('style'); 820 } else if (key == 'setNext') { 821 ob.css({ 'right' : -ob.outerWidth() }); 822 } 823 break; 824 } 825 } 826 } 827 }; 828 var animationTypes_reverse = { 829 fade : animationTypes.fade, 830 slideLeft : animationTypes.slideRight, 831 slideRight : animationTypes.slideLeft, 832 slideTop : animationTypes.slideBottom, 833 slideBottom : animationTypes.slideTop, 834 sliceUp : animationTypes.sliceUp 835 } 836 837 function animateImage (animationType,ind,direct) { 838 839 if (!now_animated) { 840 if (ind == undefined)var ind = $this.data('options').current + 1; 841 if (ind >= $item.length) ind = 0; 842 if (direct == 'reverse') animationTypes_reverse[animationType](ind) 843 else animationTypes[animationType](ind); 844 } 845 } 846 function animateText(animationType, ob, key, f) { 847 textAnimationTypes[animationType](ob,key,f); 848 } 849 function startSlider () { 850 $player.addClass('player-on'); 851 startAnimation (); 852 } 853 function stopSlider () { 854 $player.removeClass('player-on'); 855 stopAnimation (); 856 } 857 function startAnimation () { 858 $bullets.find('>*').not('.' + attrClass + '-player').removeClass('active'); 859 $bullets.find('>*').not('.' + attrClass + '-player').eq($this.data('options').current).addClass('active'); 860 inter = setInterval(repeatAnimation,settings.interval); 861 } 862 function continueAnimation () { 863 $bullets.find('>*').not('.' + attrClass + '-player').removeClass('active'); 864 $bullets.find('>*').not('.' + attrClass + '-player').eq($this.data('options').current).addClass('active'); 865 now_animated = false;
866 if ($player.is('.player-on') || !$player.length) startAnimation (); 867 } 868 function stopAnimation () { 869 clearInterval(inter); 870 } 871 function repeatAnimation() { 872 animateImage(getNextAnimation()); 873 } 874 function nexImage () { 875 animateImage(getNextAnimation()); 876 }; 877 function prevImage(){ 878 var ind = $this.data('options').current-1; 879 if (ind < 0) ind = $item.length-1; 880 animateImage(getNextAnimation(),ind,'reverse'); 881 } 882 function getNextImage() { 883 return ($this.data('options') + 1 >= $item.length?0:$this.data('options') + 1); 884 885 }; 886 function getNextAnimation() { 887 if (rand) { 888 return animations[Math.floor((Math.random()) * animations.length)] 889 } 890 else { 891 var cur_anim = $this.data('options').nextAnimation; 892 var nx_anim = cur_anim + 1; 893 894 if (nx_anim >= animations.length) nx_anim = 0; 895 896 $this.data('options',{ 897 current : $this.data('options').current, 898 nextAnimation : nx_anim 899 }); 900 return animations[cur_anim]; 901 } 902 } 903 if (settings.autoplay) startSlider(); 904 905 $next.click(nexImage); 906 $prev.click(prevImage); 907 $player.click(function(){ 908 if ($(this).is('.player-on')) { 909 stopSlider(); 910 } else { 911 startSlider(); 912 } 913 }) 914 $bullets.find('>*').not('.' + attrClass + '-player').click(function(){ 915 animateImage(getNextAnimation(),$bullets.find('>*').not('.' + attrClass + '-player').index(this)); 916 return false; 917 }); 918 }); 919 } 920 921})( 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.