28/05/2010, 05:05
|
| | Fecha de Ingreso: abril-2009
Mensajes: 38
Antigüedad: 15 años, 8 meses Puntos: 1 | |
Respuesta: Doble request de información con Ajax + PHP
Código:
var siteTitle = "Mi sitio Web XXXXXXX";
var $j = jQuery.noConflict();
var tabSpeed = 500;
var slideShowSpeed = 1000;
var slideShowTimeout = 10000;
var slideTransitionEffect = "easeInOutBack";
var transitionTime = 1200; // page changing speed
var loading = false;
var homePageSlideImageWidth = 640;
$j(document).ready(function () {
function loadContent(menu_item) {
showLoader();
var urlToLoad = menu_item;
var tuputamadreya = window.location.href;
var i = tuputamadreya.split("id=");
$j.ajax({
type: "GET",
url: urlToLoad,
data: "ajax=true&id="+i[1],
success: function(msg) {
$j(".container100x100").append(msg);
loading = false;
open_section();
hideLoader();
}
});
}
function open_section() {
$j(".size100x100:first").animate({left: "-100%"}, {queue:false, duration:transitionTime, easing:"easeInOutBack"} );
$j(".size100x100:last").animate({left: "-50%"}, {queue:false, duration:transitionTime, easing:"easeInOutBack", "complete" : function() {removeContainer()} } );
//
themeBehaviours();
}
function removeContainer() {
var containerToDelete = $j(".size100x100:first");
var containerToPosition = $j(".size100x100:last");
$j(containerToDelete).remove();
$j(containerToPosition).css({"left":0});
}
function showLoader() {
$j(".ajax_loader").remove();
$j("body").append('<div class="ajax_loader">Cargando ...</div>');
$j(".ajax_loader").fadeOut(0).fadeIn("slow");
}
function hideLoader() {
$j(".ajax_loader").fadeOut("slow", function() { $j(this).remove(); });
}
//easeInOutExpo, easeInOutElastic
function themeBehaviours() {
linksBehaviour();
inputsBehaviour();
slideshowBehaviour();
tabsBehaviour();
thumbnailBehaviour();
portfolioBehaviour();
themeCommonBehaviour();
accordionBehaviour();
}
function linksBehaviour () {
$j("#header a, .ajax_link").click(function () {
if ($j(this).hasClass("current-item") == false && loading == false) {
loading = true;
//$j(".current-item").removeClass("current-item");
//$j(this).addClass("current-item");
//loadContent($j(this).attr("href"));
SWFAddress.setValue($j(this).attr("href"));
}
return false;
});
}
function handleChange(event) {
if (event.path != "/" && event.path != "respond") {
$j(".small_slideshow, .tabs").each(function(){
$j(this).cycle('stop');
});
//
var path = event.path;
if (path.substr(path.length - 1) != '/') {
path += '/';
}
var pathToLoad = event.path.substr(1);
SWFAddress.setTitle(siteTitle + pathToLoad);
$j(".current-item").removeClass("current-item");
$j("#header a").each(function(){
if ($j(this).attr("href") == pathToLoad) {
$j(this).addClass("current-item");
}
});
loadContent(pathToLoad);
}
}
SWFAddress.addEventListener(SWFAddressEvent.CHANGE, handleChange);
});
|