$(document).ready(function(){
var animacion_traduccion = false;
var animacion_traduccion_leave = false;
var spinnerOpts = {
lines: 12,
length: 7,
width: 5,
radius: 10,
color: '#000',
speed: 1,
trail: 100,
shadow: true
};
function resultadosBusqueda(data) {
var capa = $('
Cargando...
');
$('section.resultados-buscador .contenedor').html(capa);
$('aside.buscador .borde-blanco').css('clip', 'rect(-10px 411px 368px -10px)');
$('aside.buscador .contenedor').css('clip', 'rect(-10px 410px 368px -10px)');
if ($('section.resultados-buscador').is(':visible')) {
$('section.resultados-buscador .contenedor').slideDown('normal');
} else {
$('section.resultados-buscador').slideDown('normal');
}
$.ajax({
'url': '/profesionais/',
'data': (data ? data : $('#buscador-profesionales').serialize()),
'dataType': 'html',
'success': function(data, status, xhr) {
$('section.resultados-buscador .contenedor').slideUp('normal', function(){
$('section.resultados-buscador .contenedor').html(data);
$('section.resultados-buscador .contenedor').slideDown('normal', function(){
if ($('.listado-profesionais article').length > 0) {
$('.listado-profesionais').masonry({
itemSelector: 'article',
columnWidth: 280,
gutterWidth: 20
});
}
});
});
},
'error': function() {
}
});
}
$('#buscador-profesionales').submit(function(){
if ($('section.resultados-buscador').is(':visible')) {
$('section.resultados-buscador .contenedor').slideUp('normal', resultadosBusqueda);
} else {
resultadosBusqueda();
}
return false;
});
$('.listar-todos').click(function(){
resultadosBusqueda({});
return false;
});
$('.enlaces-pe li').each(function(){
var texto = $(this).find('.texto');
$(this).colorbox({
html: function() { return texto.html(); },
width: '600px'
});
});
$('.resultados-buscador').delegate('.traduccions > div', 'mouseenter', function() {
var div = $(this);
var ancho = 280;
if (div[0].scrollWidth > 0 || div[0].scrollHeight > 0) {
//Hay overflow
}
//Si ya estamos en mostrandolo salimos del metodo sino lo marcamos en progreso
if (div.data('enter')) {
return false;
} else {
div.data('enter', true);
}
div.parent().removeClass('cortado');
//Obtenemos el tamanho inicial del div sino lo hicimos anteriormente
if (!div.data('w') || !div.data('h')) {
div.data('w', div.width());
div.data('h', div.height());
}
//Clonamos el div para obtener el alto real
//y luego lo eliminamos
//-----------------------------------------
var datos = div.clone();
datos.css({
position: 'absolute',
top: '-32000px',
left: '-32000px',
height: 'auto',
width: ancho + 'px'
});
$(document.body).append(datos);
var alto = $(datos).height();
alto = alto < div.height() ? div.height(): alto;
$(datos).remove();
//-----------------------------------------
//Redimensionamos el div al ancho preestablecido y el alto correspondiente
div.animate({
width: ancho + 'px',
height: alto + 'px',
left: ((div.data('w') - ancho) / 2) + 'px',
top: ((div.data('h') - alto) / 2) + 'px'
}, 200, function(){ $(this).data('enter', false); });
div.mouseleave(function(){
if ($(this).data('leave')) {
return false;
} else {
$(this).data('leave', true);
$(this).data('enter', false);
}
div.animate({
width: $(this).data('w') + 'px',
height: $(this).data('h') + 'px',
top: 0,
left: 0
}, 200, function(){$(this).data('leave', false);$(this).parent().addClass('cortado');});
});
});
$('.menu article h1').mouseover(function() {
$(this).parent().css({
'width': $(this).outerWidth() + 'px'
});
var article = $(this).parents('article');
if (!article.hasClass('documentos')) {
$(this).css({
'clip': 'rect(-10px, ' + ($(this).outerWidth() + 20) + 'px, 49px, -10px)',
'position': 'absolute',
'top': 0,
'left': 0
});
}
var info = article.find('div.text');
var pl = info.css('padding-left');
pl = pl ? pl.replace('px', '') : 0;
var pr = info.css('padding-right');
pr = pr ? pl.replace('px', '') : 0;
var ancho = $('div.menu').width() - pl - pr - 1;
info.width(ancho);
article.css('border-right-color', 'transparent');
});
$('.menu article h1').mouseout(function(){
$(this).parents('article').css('border-right-color', '#000');
});
if ($('.listado-profesionais article').length > 0) {
$('.listado-profesionais').masonry({
itemSelector: 'article',
columnWidth: 280,
gutterWidth: 20
});
}
});