// FUNCION PARA ANCLAS
$(function() {
$(window).scroll(function(){
var wScrollY = $(window).scrollTop();
var offsetTop = $('#logo_top').attr('data-offset')
if(wScrollY > 1){
$('#logo_top').addClass('animar_logo');
}else{
$('#logo_top').removeClass('animar_logo');
}
})
$(window).scroll(function(){
var wScrollY = $(window).scrollTop();
var offsetTop = $('#content_header').attr('data-offset')
if(wScrollY > 1){
$('#content_header').addClass('animar_header');
}else{
$('#content_header').removeClass('animar_header');
}
})
$(".carousel").on("touchstart",function(a){
var o=a.originalEvent.touches[0].pageX;
$(this).one("touchmove",function(a){
var c=a.originalEvent.touches[0].pageX;
Math.floor(o-c)>5?$(".carousel")
.carousel("next"):Math.floor(o-c)<-5&&$(".carousel").carousel("prev")
}),
$(".carousel").on("touchend",function(){
$(this).off("touchmove")
});
});
$("#lista_sabores").owlCarousel({
autoPlay: false,
items : 4,
navigation:true,
navigationText : ["",""],
itemsDesktop : [1199,3],
itemsDesktopSmall : [979,3]
});
$("#carousel_product").owlCarousel({
autoPlay: false,
items : 5,
navigation:true,
navigationText : ["",""],
itemsDesktop : [1199,3],
itemsDesktopSmall : [979,3]
});
$('#btn_map').on('click', function(){
$('#map').slideToggle('slow');
});
$('#menu').on('click', function(){
var mimenu = $('#menu').hasClass('off');
if(mimenu){
$('#access').removeClass('inactivo');
$('#access').addClass('activo');
$('#menu').removeClass('off');
$('#menu').addClass('on');
}
else{
$('#access').removeClass('activo');
$('#access').addClass('inactivo');
$('#menu').removeClass('on');
$('#menu').addClass('off');
}
});
$(".menu_ppal li a").click(function(){
var textmenu2 = $('#menu').hasClass('on');
if(textmenu2){
$("#menu h6").text('MenĂº');
}else{
$("#menu h6").text('Cerrar');
}
});
$("#menu").click(function(){
var textmenu = $('#menu').hasClass('off');
if(textmenu){
$("#menu h6").text('MenĂº');
}else{
$("#menu h6").text('Cerrar');
}
});
$('.menu_ppal li a').on('click', function(){
var clMobil = $('#access').hasClass('activo');
if(clMobil){
$('#access').removeClass('activo');
$('#access').addClass('inactivo');
$('#menu').removeClass('on');
$('#menu').addClass('off');
}
});
resizeContent();
$( window ).load(function() {
resizeContent();
});
$('#slider_sabores').carousel({
interval: false
})
});
function resizeContent() {
if ( $( window ).width()>760) {
$height = $('#figure_page img').height();
$('#entry_page').height($height);
}else{
$height = $('#figure_page img').height();
$('#entry_page').height('auto');
}
}