Current File : /home/aventura/public_html/js/diaadia.js |
/*Cufon.replace('h2', {fontFamily: "Lobster 1.3" });
Cufon.replace('h3', {fontFamily: "Lobster 1.3" });
Cufon.replace('h4', {fontFamily: "Lobster 1.3" });
Cufon.replace('.titulo', {fontFamily: "Lobster 1.3" });
Cufon.replace('.moreButton_Type2', {fontFamily: "Lobster 1.3" });*/
$(document).ready(function() {
var ua = navigator.userAgent.toLowerCase(),
selectItem = 0,
allItem = $("#servicesSlider").find(".sliderItem").length,
animationState = true;
addbutonEvent();
//alert('HOLA');
function addbutonEvent(){
$("#nextButton").click(nextClickHandler);
$("#prevButton").click(prevClickHandler);
$("#nextButton").hover(overHandler, outHandler);
$(".moreButton_Type2").hover(overHandler_2, outHandler_2);
$("#prevButton").hover(overHandler, outHandler);
$("#nextButton").css({"visibility":"hidden"});
function overHandler(){
var item = $(this);
if (ua.indexOf("msie") == -1) {
item.stop().animate({"backgroundColor":"#74c5f2"},300,"easeOutCubic");
}else{
//-----IE------
item.css({"backgroundColor":"#74c5f2"});
//-----!IE-----
}
}
function outHandler(){
var item = $(this);
if (ua.indexOf("msie") == -1) {
item.stop().animate({"backgroundColor":"#8b2786"},300,"easeOutCubic");
}else{
//-----IE------
item.css({"backgroundColor":"#8b2786"});
//-----!IE-----
}
}
function overHandler_2(){
var item = $(this);
if (ua.indexOf("msie") == -1) {
item.stop().animate({"backgroundColor":"#F759A1"},300,"easeOutCubic");
}else{
//-----IE------
item.css({"backgroundColor":"#F759A1"});
//-----!IE-----
}
}
function outHandler_2(){
var item = $(this);
if (ua.indexOf("msie") == -1) {
item.stop().animate({"backgroundColor":"#8b2786"},300,"easeOutCubic");
}else{
//-----IE------
item.css({"backgroundColor":"#8b2786"});
//-----!IE-----
}
}
function nextClickHandler(){
if(!animationState){
if(selectItem!=0){
selectItem--;
animationState = true;
changeItem();
$("#prevButton").css({"visibility":"visible"})
}
if(selectItem==0){
$(this).css({"visibility":"hidden"})
}
}
}
function prevClickHandler(){
if(!animationState){
if(selectItem!=allItem-2){
selectItem++;
animationState = true;
changeItem();
$("#nextButton").css({"visibility":"visible"})
}
if(selectItem==allItem-2){
$(this).css({"visibility":"hidden"})
}
}
}
changeItem()
}
function changeItem(){
var itemLeftPosition;
for(var i = 0; i!=allItem; i++){
if(i==selectItem){
$(".sliderItem").eq(i).css({"visibility":"visible"}).animate({"left":(-505*selectItem)}, 500, "easeInOutCubic", animationComplete);
$(".sliderItem").eq(i+1).css({"visibility":"visible"}).animate({"left":(-505*selectItem)}, 500, "easeInOutCubic");
}
if(i>selectItem+1){
$(".sliderItem").eq(i).animate({"left":($(window).width())}, 700, "easeInOutCubic")
}
if(i<selectItem){
itemLeftPosition = parseInt($(".sliderItem").eq(i).css("left"));
$(".sliderItem").eq(i).animate({"left":-(($(window).width())+1500)}, 700, "easeInOutCubic")
}
}
}
function animationComplete(){
animationState = false;
for(var i = 0; i!=allItem; i++){
if(i>selectItem+1){
$(".sliderItem").eq(i).css({"visibility":"hidden"});
}
if(i<selectItem){
$(".sliderItem").eq(i).css({"visibility":"hidden"});
}
}
}
});