jQuery(document).ready(function($) { $('#menu-toggle').click(function(e){ $(this).toggleClass('active').next().toggleClass('active'); e.preventDefault(); }); if($('#featured-slider').length > 0 ) { var child = $('#featured-slider').find('.slide-item .slide-caption'); child.each(function(){ var child_h = $(this).outerHeight(); var child_more_h = 0; if($(this).find('.slide-more').length > 0 ){ child_more_h += 49; } $(this).css({ 'top' : '50%', 'margin-top' : -((child_h - child_more_h) / 2) }); }); $('#featured-slider').bxSlider({ slideSelector: '.slide-item', pager: false, controls: true, nextSelector: "#featured-slider-control", prevSelector: "#featured-slider-control", autoStart: false, mode: 'fade', nextText: '', prevText: '', onSliderLoad: function( index ) { $(this.slideSelector).eq(index).delay(80).queue(function(){ $(this).addClass('active'); $(this).dequeue(); }); }, onSlideBefore: function($elem, oldI, newI){ $(this.slideSelector).eq(oldI).removeClass('active'); }, onSlideAfter: function($elem, oldI, newI){ $(this.slideSelector).eq(newI).addClass('active'); } }); } if ( $('.bearded-gallery-carousel').length > 0 ) { $('.bearded-gallery-carousel').each(function(){ var id = $(this).attr('id'); $('#' + id ).bxSlider({ slideSelector: '.gallery-carousel-item', pager: false, controls: true, nextSelector: "#"+id+"-control", prevSelector: "#"+id+"-control", autoStart: false, mode: 'fade', adaptiveHeight: true, nextText: '', prevText: '', }); }); } // just a really simple tooltip /*if( $('.entry-published').length > 0 ) { $('.entry-published').each(function(){ $(this).children('time').hover(function(event){ var tooltip = '
'; var content = $(this).attr('title'); $(this).removeAttr('title'); $(tooltip).text(content).appendTo('body').fadeIn(); }, function(event){ var content = $('.bearded-tooltip').text(); $('.bearded-tooltip').fadeOut().text(''); $(this).attr('title', content); $('.bearded-tooltip').remove(); }); }).mousemove(function(event) { var mousex = event.pageX + 15; //Get X coordinates var mousey = event.pageY - 30; //Get Y coordinates $('.bearded-tooltip').css({ top: mousey, left: mousex }) }); }*/ $('.bearded-tip').each(function( event ){ $(this).click(function( event ){ if(!($(this).hasClass('tip-active'))) { $(this).addClass('tip-active'); var tooltip = '
'; var content = $(this).attr('title'); $(this).removeAttr('title'); var offset = $(this).offset(); var mousex = offset.left + $(this).outerWidth() + 8; //Get X coordinates var mousey = offset.top ; //Get Y coordinates console.log($(tooltip).outerHeight()); $(tooltip).text(content).appendTo('body').offset({ top: mousey, left: mousex }).fadeIn(); } else { $(this).removeClass('tip-active'); var $t = $(this); $('.bearded-tooltip').each(function(){ var datatip = $(this).data('tip'); var content = $(this).text(); if(datatip == $t.attr('id')) { $(this).fadeOut().text('').remove(); $t.attr('title', content); } }); } }); }); });