Ver Mensaje Individual
  #2 (permalink)  
Antiguo 24/07/2011, 22:30
Avatar de jtkm6
jtkm6
 
Fecha de Ingreso: abril-2011
Mensajes: 19
Antigüedad: 10 años, 5 meses
Puntos: 1
Respuesta: Guardar cambios en Drag & Drop

Encontré este código en una pagina aquí del foro pero la cookie no se guarda????
Ayúdenme por favor....


Código HTML:
<html>
<head>
<title> </title>
 <script type="text/javascript" src="js/jquery-latest.pack.js"></script>
 <script type="text/javascript" src="js/ui.core.js"></script>
 <script type="text/javascript" src="js/ui.draggable.js"></script>
 <script type="text/javascript" src="js/jquery.cookie.js"></script>
 <script type="text/javascript">
    function getCookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ';', len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
    }
    function setCookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name+'='+escape( value ) +
		( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + //expires.toGMTString()
		( ( path ) ? ';path=' + path : '' ) +
		( ( domain ) ? ';domain=' + domain : '' ) +
		( ( secure ) ? ';secure' : '' );
    }
 </script>
 <script type="text/javascript">

$(document).ready(function(){
    
    var o = {
            cursor:"crosshair",
            stop:function(e,ui){
                setCookie( $(this).attr("alt"), ui.absolutePosition.top +"::"+ ui.absolutePosition.left );
            }
            };
    
    $("*[alt^='dRag']").each(function(i){
    
        var th = $(this);
        var coo = getCookie( th.attr("alt") );
        if( coo!=undefined ){
            var pos = coo.split("::");
            th.css({top:pos[0],left:pos[1]});
        }
        th.draggable(o);
    
    });

});

 </script>
</head>






<img src="http://www.forosdelweb.com/images/logos/logo_foros.png" alt="dRag11" style="position:absolute;"></img>
<img src="http://www.seriousteam.es/images/forosdelweb2.JPG" alt="dRag10" style="position:absolute;"></img>
<span alt="dRag0" style="position:absolute;font-size:1em;">TEXTO0</span>
<span alt="dRag1" style="position:absolute;font-size:2.1em;color:brown;">TEXTO1</span>
<span alt="dRag2" style="position:absolute;font-size:1.2em;color:pink;">TEXTO2</span>
<span alt="dRag3" style="position:absolute;font-size:1.7em;color:green;">TEXTO3</span>
<span alt="dRag4" style="position:absolute;">TEXTO4</span>
<span alt="dRag5" style="position:absolute;font-size:2em;color:blue;">TEXTO5</span>
<span alt="dRag6" style="position:absolute;font-size:1.3em;color:orange;">TEXTO6</span>
<span alt="dRag7" style="position:absolute;">TEXTO7</span>
<span alt="dRag8" style="position:absolute;font-size:1.5em;color:violet;">TEXTO8</span>
<span alt="dRag9" style="position:absolute;font-size:1em;color:red;">TEXTO9</span>



</body>
</html>