Pregunta

¿Cómo puedo agregar efectos de transiciones de página como IE en Safari para páginas web?

¿Fue útil?

Solución

Podrías consultar este ejemplo: http://sachiniscool.blogspot.com/2006/01/implementing-page-transitions-in.html.Describe cómo emular transiciones de páginas en Firefox usando AJAX y CSS.El mismo método también funciona para Safari.El siguiente código está tomado de esa página y ligeramente formateado:

var xmlhttp;
var timerId = 0;
var op = 1;

function getPageFx() {
  url = "/transpage2.html";
  if (window.XMLHttpRequest) {
    xmlhttp = new XMLHttpRequest()
    xmlhttp.onreadystatechange=xmlhttpChange
    xmlhttp.open("GET",url,true)
    xmlhttp.send(null)
  } else getPageIE();
}

function xmlhttpChange() {
// if xmlhttp shows "loaded"
  if (xmlhttp.readyState == 4) {
  // if "OK"
    if (xmlhttp.status == 200) {
      if (timerId != 0)
        window.clearTimeout(timerId);
        timerId = window.setTimeout("trans();",100);
    } else {
       alert(xmlhttp.status)
    }
  }
}

function trans() {
  op -= .1;
  document.body.style.opacity = op;
  if(op < .4) {
    window.clearTimeout(timerId);
    timerId = 0; document.body.style.opacity = 1;
    document.open();
    document.write(xmlhttp.responseText);
    document.close();
    return;
  }
  timerId = window.setTimeout("trans();",100);
}

function getPageIE() {
  window.location.href = "transpage2.html";
}

Otros consejos

Verificar Scriptaculous.Evite JS solo para IE si se refiere a eso (no tengo idea de a qué tipo de efecto se refiere).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top