Foros del Web » Programando para Internet » Javascript »

Ventana al abrir web

Estas en el tema de Ventana al abrir web en el foro de Javascript en Foros del Web. Que tal gente =) necesito un poco de su ayuda, resulta que quiero algo como esto http://www.queness.com/resources/html/modal/jquery-modal-window.html pero que se haga al entrar a la ...
  #1 (permalink)  
Antiguo 09/02/2012, 22:37
 
Fecha de Ingreso: octubre-2010
Ubicación: Mexico
Mensajes: 19
Antigüedad: 13 años, 6 meses
Puntos: 0
Ventana al abrir web

Que tal gente =) necesito un poco de su ayuda, resulta que quiero algo como esto http://www.queness.com/resources/html/modal/jquery-modal-window.html pero que se haga al entrar a la web, apenas un usuario entre salga alguna ventana como esas que se muestran en el ejemplo, de antemano doy las gracias por su ayuda =)
  #2 (permalink)  
Antiguo 10/02/2012, 04:08
Avatar de ZiTAL  
Fecha de Ingreso: marzo-2004
Ubicación: Bermio (Bizkaia)
Mensajes: 1.545
Antigüedad: 20 años, 1 mes
Puntos: 62
Respuesta: Ventana al abrir web

sí es con jquery lo metes en:

Código Javascript:
Ver original
  1. <script type="text/javascript">
  2. $(document).ready(function()
  3. {
  4. // aqui el codigo para cargar la ventana
  5. });
  6. </script>

si no es jquery:

Código Javascript:
Ver original
  1. <script type="text/javascript">
  2. window.onload = function()
  3. {
  4. // aqui el codigo para cargar la ventana
  5. };
  6. </script>
__________________
http://zital.no-ip.org
____________________

Euskerie ahuen eta bijotzan
  #3 (permalink)  
Antiguo 10/02/2012, 14:34
 
Fecha de Ingreso: octubre-2010
Ubicación: Mexico
Mensajes: 19
Antigüedad: 13 años, 6 meses
Puntos: 0
Respuesta: Ventana al abrir web

Cita:
Iniciado por ZiTAL Ver Mensaje
sí es con jquery lo metes en:

Código Javascript:
Ver original
  1. <script type="text/javascript">
  2. $(document).ready(function()
  3. {
  4. // aqui el codigo para cargar la ventana
  5. });
  6. </script>

si no es jquery:

Código Javascript:
Ver original
  1. <script type="text/javascript">
  2. window.onload = function()
  3. {
  4. // aqui el codigo para cargar la ventana
  5. };
  6. </script>
No pude comprender el ejemplo, que codigo es el que tengo que meter dentro? si esta todo esto

Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Simple JQuery Modal Window from Queness</title>

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
<script>

$(document).ready(function() {	

	//select all the a tag with name equal to modal
	$('a[name=modal]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = $(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",0.8);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
		$(id).fadeIn(2000); 
	
	});
	
	//if close button is clicked
	$('.window .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		
		$('#mask').hide();
		$('.window').hide();
	});		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});			
	
});

</script>
<style>
body {
font-family:verdana;
font-size:15px;
}

a {color:#333; text-decoration:none}
a:hover {color:#ccc; text-decoration:none}

#mask {
  position:absolute;
  left:0;
  top:0;
  z-index:9000;
  background-color:#000;
  display:none;
}
  
#boxes .window {
  position:absolute;
  left:0;
  top:0;
  width:440px;
  height:200px;
  display:none;
  z-index:9999;
  padding:20px;
}

#boxes #dialog {
  width:375px; 
  height:203px;
  padding:10px;
  background-color:#ffffff;
}

#boxes #dialog1 {
  width:375px; 
  height:203px;
}

#dialog1 .d-header {
  background:url(images/login-header.png) no-repeat 0 0 transparent; 
  width:375px; 
  height:150px;
}

#dialog1 .d-header input {
  position:relative;
  top:60px;
  left:100px;
  border:3px solid #cccccc;
  height:22px;
  width:200px;
  font-size:15px;
  padding:5px;
  margin-top:4px;
}

#dialog1 .d-blank {
  float:left;
  background:url(images/login-blank.png) no-repeat 0 0 transparent; 
  width:267px; 
  height:53px;
}

#dialog1 .d-login {
  float:left;
  width:108px; 
  height:53px;
}

#boxes #dialog2 {
  background:url(images/notice.png) no-repeat 0 0 transparent; 
  width:326px; 
  height:229px;
  padding:50px 0 20px 25px;
}
</style>
</head>
<body>
<h2><a href="http://www.queness.com">Simple jQuery Modal Window Examples from Queness WebBlog</a></h2>

<ul>
<li><a href="http://www.queness.com">Normal Link</a></li>
<li><a href="#dialog" name="modal">Simple Window Modal</a></li>
<li><a href="#dialog1" name="modal">Login Dialog Box</a></li>
<li><a href="#dialog2" name="modal">Sticky Note</a></li>
</ul>

<div style="font-size:10px;color:#ccc">Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 License.</div>

<div id="boxes">

<div id="dialog" class="window">
Simple Modal Window | 
<a href="#"class="close"/>Close it</a>
</div>
  
<!-- Start of Login Dialog -->  
<div id="dialog1" class="window">
  <div class="d-header">
    <input type="text" value="username" onclick="this.value=''"/><br/>
    <input type="password" value="Password" onclick="this.value=''"/>    
  </div>
  <div class="d-blank"></div>
  <div class="d-login"><input type="image" alt="Login" title="Login" src="images/login-button.png"/></div>
</div>
<!-- End of Login Dialog -->  



<!-- Start of Sticky Note -->
<div id="dialog2" class="window">
  So, with this <b>Simple Jquery Modal Window</b>, it can be in any shapes you want! Simple and Easy to modify : ) <br/><br/>
<input type="button" value="Close it" class="close"/>
</div>
<!-- End of Sticky Note -->



<!-- Mask to cover the whole screen -->
  <div id="mask"></div>
</div>



</body>
</html>
  #4 (permalink)  
Antiguo 10/02/2012, 18:56
 
Fecha de Ingreso: octubre-2010
Ubicación: Mexico
Mensajes: 19
Antigüedad: 13 años, 6 meses
Puntos: 0
Respuesta: Ventana al abrir web

Ya lo solucione, a los que les interese les dejo el link http://jqueryui.com/demos/dialog/

Etiquetas: html, ventanas
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 01:35.