2010-05-03 7 views

Répondre

11

À JOUR avec des effets d'accélération

DEMO:http://so.devilmaycode.it/jquery-colorbox-background-transition-effect/

$('.example').colorbox({ 
    //added to remove initial flickering 
    opacity : 0, 
    //use the onOpen event... 
    onOpen: function() { 
     // prevent Overlay from being displayed... 
     $('#cboxOverlay,#colorbox').css('visibility', 'hidden'); 
     // make the overlay visible and 
     // re-add all it's original properties! 
     $('#cboxOverlay').css({ 
      'visibility': 'visible', 
      'opacity': 0.9, 
      'cursor': 'pointer' 
      // execute our original animation on the overlay! 
      // animate it you can use here all the 
      // possible animate combination or plugin... 
     }).animate({ 
      height: ['toggle', 'swing'], 
      opacity: 'toggle' 
     }, 1000 , function() { 
      $('#colorbox').css({ 
      'visibility': 'visible' 
     }).fadeIn(1000); 
     }); 
    } 
}); 
+0

Votre exemple semble bien, mais l'affichage de la boîte n'attend pas que l'affichage de l'arrière-plan se termine ... Je ne pense pas qu'il existe une solution valable pour ça ..? – Ropstah

+0

oui c'est possible! voir les mises à jour! –

+0

vous êtes les bienvenus! ;-) n'oubliez pas que vous pouvez bien sûr utiliser animer au lieu de fadeIn et viceversa! utilisez aussi le plugin d'accélération qui tourne! –