//jquery var queue = new Array(2); var link_to_php_folder = '//www.animalslebanon.org/php/'; var _WD = ''; var curr_menu = $('.selecthover'); function bindMenusDesk(title, index) { var menu = title + "drop"; $(menu).on('mouseover', function() { curr_menu.removeClass('selecthover'); $(title).addClass('copyhover'); queue[index] = false; }); $(menu).on('mouseout', function(event) { queue[index] = true; curr_menu.addClass('selecthover'); setTimeout(function(){ hideAfter(menu, title, index); }, 100) }); $(title).on('mouseover', function() { $(menu).fadeIn(300); curr_menu.removeClass('selecthover'); $(title).addClass('copyhover'); queue[index] = false; }); $(title).on('mouseout', function(event) { queue[index] = true; curr_menu.addClass('selecthover'); setTimeout(function(){ hideAfter(menu, title, index); }, 100) }); } function hideAfter(which, other, index) { if (queue[index]) { $(other).removeClass('copyhover'); $(which).fadeOut(100); queue[index] = false; } } function initMenu(){ index = 0; $('.bar_item').each( function () { bindMenusDesk('#' + $(this).attr('id'), index); index++; }); } initMenu(); $(window).ready(function() { if ($('.fotorama').length) { $('#botl2').append(''); } $('#mobile_menub').on('click', function() { if ($("#mobile_menub").hasClass("mobile_menub_hover")) { $("#mobile_menub").removeClass("mobile_menub_hover"); $("#bar").fadeOut(400); } else { $("#mobile_menub").addClass("mobile_menub_hover"); $("#bar").fadeIn(300); //hideSearch(); } }); $('#magni').on('click',function() { if ($("a.donate_now").css('opacity') == 1) { $("a.donate_now").fadeOut(400); $('.searchf').focus(); } }); $('.searchf').on('focusout', function() { $("a.donate_now").fadeIn(300); }); }); (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-3192862-7', 'auto'); ga('send', 'pageview'); var $allVideos = $("iframe[src^='http://www.player.vimeo.com'], iframe[src^='http://www.youtube.com'], iframe[src^='https://www.youtube.com'], iframe[src^='https://www.facebook.com'], iframe[src^='http://www.facebook.com'], iframe[src^='https://www.youtube-nocookie.com'], object, embed, player"), $fluidEl = $("#content"); if (!$fluidEl.width()) { $fluidEl = $("#white_page"); } if (!$fluidEl.width()) { $fluidEl = $(".text"); } // Figure out and save aspect ratio for each video $allVideos.each(function() { $(this) .data('aspectRatio', this.height / this.width) // and remove the hard coded width/height .removeAttr('height') .removeAttr('width'); }); if ($('.related_stories').length) { $.ajax({ type: "POST", url: link_to_php_folder + 'related_stories.php', data: { flag: $('.related_stories').attr('flag') }, success: function(data) { $('.related_stories').html(data); } }); } // When the window is resized $(window).resize(function() { var newWidth = $fluidEl.width(); // Resize all videos according to their own aspect ratio $allVideos.each(function() { var $el = $(this); $el .width(newWidth) .height(newWidth * $el.data('aspectRatio')); }); // Kick off one resize to fix all videos on page load }).resize();