vendor/assets/javascripts/foundation/app.js in zurb-foundation-2.1.3.1 vs vendor/assets/javascripts/foundation/app.js in zurb-foundation-2.1.4

- old
+ new

@@ -27,57 +27,66 @@ }); if (window.location.hash) { activateTab($('a[href="' + window.location.hash + '"]')); } - + /* ALERT BOXES ------------ */ - $(".alert-box").delegate("a.close", "click", function() { - $(this).closest(".alert-box").fadeOut(function(){ + $(".alert-box").delegate("a.close", "click", function(event) { + event.preventDefault(); + $(this).closest(".alert-box").fadeOut(function(event){ $(this).remove(); }); }); /* PLACEHOLDER FOR FORMS ------------- */ /* Remove this and jquery.placeholder.min.js if you don't need :) */ $('input, textarea').placeholder(); + + + /* UNCOMMENT THE LINE YOU WANT BELOW IF YOU WANT IE6/7/8 SUPPORT AND ARE USING .block-grids */ +// $('.block-grid.two-up>li:nth-child(2n+1)').css({clear: 'left'}); +// $('.block-grid.three-up>li:nth-child(3n+1)').css({clear: 'left'}); +// $('.block-grid.four-up>li:nth-child(4n+1)').css({clear: 'left'}); +// $('.block-grid.five-up>li:nth-child(5n+1)').css({clear: 'left'}); + + + /* DROPDOWN NAV ------------- */ - /* + + var currentFoundationDropdown = null; $('.nav-bar li a, .nav-bar li a:after').each(function() { $(this).data('clicks', 0); }); - $('.nav-bar li a, .nav-bar li a:after').bind('touchend click', function(e){ - e.stopPropagation(); + $('.nav-bar li a, .nav-bar li a:after').live('click', function(e) { e.preventDefault(); - var f = $(this).siblings('.flyout'); + if (currentFoundationDropdown !== $(this).index() || currentFoundationDropdown === null) { + $(this).data('clicks', 0); + currentFoundationDropdown = $(this).index(); + } $(this).data('clicks', ($(this).data('clicks') + 1)); - if (!f.is(':visible') && f.length > 0) { + var f = $(this).siblings('.flyout'); + if (!f.is(':visible') && $(this).parent('.has-flyout').length > 1) { $('.nav-bar li .flyout').hide(); f.show(); - } - }); - $('.nav-bar li a, .nav-bar li a:after').bind(' touchend click', function(e) { - e.stopPropagation(); - e.preventDefault(); - if ($(this).data('clicks') > 1) { + } else if (($(this).data('clicks') > 1) || ($(this).parent('.has-flyout').length < 1)) { window.location = $(this).attr('href'); } }); - $('.nav-bar').bind('touchend click', function(e) { + $('.nav-bar').live('click', function(e) { e.stopPropagation(); - if (!$(e.target).parents('.nav-bar li .flyout') || $(e.target) != $('.nav-bar li .flyout')) { + if ($(e.target).parents().is('.flyout') || $(e.target).is('.flyout')) { e.preventDefault(); } }); - $('body').bind('touchend', function(e) { - if (!$(e.target).parents('.nav-bar li .flyout') || $(e.target) != $('.nav-bar li .flyout')) { - $('.nav-bar li .flyout').hide(); - } - }); - */ + // $('body').bind('touchend', function(e) { + // if (!$(e.target).parents().is('.nav-bar') || !$(e.target).is('.nav-bar')) { + // $('.nav-bar li .flyout').is(':visible').hide(); + // } + // }); /* DISABLED BUTTONS ------------- */ /* Gives elements with a class of 'disabled' a return: false; */ });