Ver Mensaje Individual
  #4 (permalink)  
Antiguo 01/09/2012, 11:03
Avatar de YYs86
YYs86
 
Fecha de Ingreso: abril-2012
Ubicación: Salamanca
Mensajes: 136
Antigüedad: 12 años
Puntos: 14
Respuesta: Imagen jquery que aparece automaticamente al entrar a una web

Así es como tienen declaradas las funciones en la propia página que has puesto tu de ejemplo:

Código Javascript:
Ver original
  1. function launchPopup(){
  2. centerPopup();
  3. loadPopup();
  4. }
  5. //loading popup with jQuery
  6. function loadPopup(){
  7. //loads popup only if it is disabled
  8. if(popupStatus==0){
  9. $("#backgroundPopup").css({"opacity": "0.7"});
  10. $("#backgroundPopup").fadeIn("slow");
  11. $("#popupModal").fadeIn("slow");
  12. popupStatus = 1;
  13. }
  14. }
  15. //disabling popup with jQuery
  16. function disablePopup(){
  17. //disables popup only if it is enabled
  18. if(popupStatus==1){
  19. $("#backgroundPopup").fadeOut("slow");
  20. $("#popupModal").fadeOut("slow");
  21. popupStatus = 0;
  22. }
  23. }
  24. //centering popup
  25. function centerPopup(){
  26. //request data for centering
  27. var windowWidth = document.documentElement.clientWidth;
  28. var windowHeight = document.documentElement.clientHeight;
  29. var popupHeight = $("#popupModal").height();
  30. var popupWidth = $("#popupModal").width();
  31. //centering
  32. $("#popupModal").css({
  33. "position": "absolute",
  34. "top": windowHeight/2-popupHeight/2,
  35. "left": windowWidth/2-popupWidth/2
  36. });
  37. //only need force for IE6
  38. $("#backgroundPopup").css({
  39. "height": windowHeight
  40. });
  41. }

Las funciones pueden ser lanzadas por cualquier evento que tu quieras, ya sea un click(), un mouseover(), mouseenter(), keydown(),...

Tal y como lo tienen ellos declarado tienen encerrada la llamada a la función que crea el popup en un $(document).ready()...
__________________
Web developer:

http://xtremgaming.es
http://leaderleague.com