Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 31st, 2012  |  syntax: None  |  size: 2.34 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. jQuery video onpause play animation
  2. //clicking on a thumb, replaces the large image or video
  3.                 $list.find('.st_thumbs img').bind('click',function(){
  4.                 var $this = $(this);
  5.                 $loader.show();
  6.                 var src = $this.attr('alt');
  7.                 if (/.(mp4|ogv)$/i.test(src)) {
  8.                 var $currImage = $('#st_main').children('img,video').first();
  9.                 $("<video class='st_preview' controls='controls' id='video' preload='auto'>").attr({ src: src }).insertBefore($currImage);
  10.  
  11.                 $('.st_overlay').hide();
  12.                 setTimeout('playVid()', 5000);
  13.                 $socialLinks.animate({ 'left': -($socialLinks.width()) }, 500);
  14.                 hideThumbs();
  15.                     $("video").bind("play", function() {
  16.                        $list.children().each(function(i,el) { // loop through the LI elements within $list
  17.                             $(el).delay(500*i).animate({'left':'-300px'},1000);
  18.                         });
  19.                     });
  20.  
  21.                     $("video").bind("pause", function() {
  22.                        $list.children().each(function(i,el) { // loop through the LI elements within $list
  23.                             $(el).delay(500*i).animate({'left':'300px'},1000);
  24.                         });
  25.                     });
  26.  
  27.                 $download.fadeOut(1000);
  28.                 $currImage.fadeOut(2000,function(){
  29.                     $(this).remove();
  30.                 });
  31.             }
  32.                 else {
  33.                     $('<img class="st_preview"/>').load(function(){
  34.                         var $this = $(this);
  35.                         var $currImage = $('#st_main').children('img,video').first();
  36.                         $this.insertBefore($currImage);
  37.                         $loader.hide();
  38.                         $('.st_overlay').show();
  39.                         $socialLinks.animate({ 'left': '0px' }, 1000);
  40.                         $download.fadeIn(2500);
  41.                         $currImage.fadeOut(2000,function(){
  42.                             $(this).remove();
  43.                         });
  44.                     }).attr('src',src);
  45.                 }
  46.                 setTimeout('$("a.st_img_download").attr("href", "image_download.php?image="+$('#st_main').children('img:first').attr("src"))', 500);
  47.                 });
  48.        
  49. if (video.paused) {
  50.      //show menu
  51. }