Permalink
Browse files

Updated to the latest version of Foundation3

  • Loading branch information...
1 parent 78e0e15 commit 3aba6fb1076207c4bd4c8de594c760e580f8baec @antonydoyle committed Oct 2, 2012
View

Large diffs are not rendered by default.

Oops, something went wrong.
View

Large diffs are not rendered by default.

Oops, something went wrong.
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -51,7 +51,7 @@ dl.article-info {
}
.details {
- padding:9.5px 35px !important;
+ padding:9px 35px !important;
}
.article-details {
padding:5px;
@@ -49,7 +49,7 @@
</h1>
</header>
<?php endif; ?>
-<section class="article-details panel">
+<section class="article-details">
<ul>
<li>
<?php if ($canEdit || $params->get('show_print_icon') || $params->get('show_email_icon')) : ?>
View
@@ -1,35 +1,48 @@
-(function($){
- $(function(){
-
- $(document).foundationAlerts();
- $(document).foundationAccordion();
- $(document).tooltips();
- $('input, textarea').placeholder();
-
-
-
- $(document).foundationButtons();
-
-
-
- $(document).foundationNavigation();
-
-
-
- $(document).foundationCustomForms();
-
-
-
-
- $(document).foundationTabs({callback:$.foundation.customForms.appendCustomMarkup});
-
+;(function ($, window, undefined) {
+ 'use strict';
+
+ var $doc = $(document),
+ Modernizr = window.Modernizr;
+
+
+ $.fn.foundationAlerts ? $doc.foundationAlerts() : null;
+ $.fn.foundationAccordion ? $doc.foundationAccordion() : null;
+ $.fn.foundationTooltips ? $doc.foundationTooltips() : null;
+ $('input, textarea').placeholder();
+
+
+ $.fn.foundationButtons ? $doc.foundationButtons() : null;
+
+
+ $.fn.foundationNavigation ? $doc.foundationNavigation() : null;
+
+
+ $.fn.foundationTopBar ? $doc.foundationTopBar() : null;
+
+ $.fn.foundationCustomForms ? $doc.foundationCustomForms() : null;
+ $.fn.foundationMediaQueryViewer ? $doc.foundationMediaQueryViewer() : null;
+
+ $.fn.foundationTabs ? $doc.foundationTabs() : null;
- // UNCOMMENT THE LINE YOU WANT BELOW IF YOU WANT IE8 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'});
- });
-
-})(jQuery);
+
+
+ $("#featured").orbit();
+
+
+ // UNCOMMENT THE LINE YOU WANT BELOW IF YOU WANT IE8 SUPPORT AND ARE USING .block-grids
+ // $('.block-grid.two-up>li:nth-child(2n+1)').css({clear: 'both'});
+ // $('.block-grid.three-up>li:nth-child(3n+1)').css({clear: 'both'});
+ // $('.block-grid.four-up>li:nth-child(4n+1)').css({clear: 'both'});
+ // $('.block-grid.five-up>li:nth-child(5n+1)').css({clear: 'both'});
+
+ // Hide address bar on mobile devices
+ if (Modernizr.touch) {
+ $(window).load(function () {
+ setTimeout(function () {
+ window.scrollTo(0, 1);
+ }, 0);
+ });
+ }
+
+})(jQuery, this);
View

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1,15 +1,17 @@
-(function ($){
-
+;(function ($, window, undefined){
+ 'use strict';
+
$.fn.foundationAccordion = function (options) {
-
+
$('.accordion li', this).on('click.fndtn', function () {
+ var p = $(this).parent(); //changed this
var flyout = $(this).children('.content').first();
- $('.accordion .content').not(flyout).hide().parent('li').removeClass('active');
+ $('.content', p).not(flyout).hide().parent('li').removeClass('active'); //changed this
flyout.show(0, function () {
flyout.parent('li').addClass('active');
});
});
-
+
};
-})( jQuery );
+})( jQuery, this );
@@ -1,13 +1,14 @@
-(function ($) {
+;(function ($, window, undefined) {
+ 'use strict';
$.fn.foundationAlerts = function (options) {
var settings = $.extend({
callback: $.noop
}, options);
- $(document).on("click", ".alert-box a.close", function (event) {
- event.preventDefault();
- $(this).closest(".alert-box").fadeOut(function (event) {
+ $(document).on("click", ".alert-box a.close", function (e) {
+ e.preventDefault();
+ $(this).closest(".alert-box").fadeOut(function () {
$(this).remove();
// Do something else after the alert closes
settings.callback();
@@ -16,4 +17,4 @@
};
-})(jQuery);
+})(jQuery, this);
@@ -1,29 +1,39 @@
-(function ($) {
-
- $.fn.foundationButtons = function(options) {
+;(function ($, window, undefined) {
+ 'use strict';
+
+ $.fn.foundationButtons = function(options) {
+ var $doc = $(document);
// Prevent event propagation on disabled buttons
- $('.button.disabled', this).on('click.fndtn', function (event) {
- event.preventDefault();
+ $doc.on('click.fndtn', '.button.disabled', function (e) {
+ e.preventDefault();
});
-
+
$('.button.dropdown > ul', this).addClass('no-hover');
- $('.button.dropdown', this).on('click.fndtn', function (e) {
- e.stopPropagation();
+ $doc.on('click.fndtn', '.button.dropdown, .button.dropdown.split span', function (e) {
+ // Stops further propagation of the event up the DOM tree when clicked on the button.
+ // Events fired by its descendants are not being blocked.
+ $('.button.dropdown').children('ul').removeClass('show-dropdown');
+ if (e.target === this) {
+ e.stopPropagation();
+ }
});
- $('.button.dropdown.split span', this).on('click.fndtn', function (e) {
+
+ $doc.on('click.fndtn', '.button.dropdown.split span', function (e) {
e.preventDefault();
$('.button.dropdown', this).not($(this).parent()).children('ul').removeClass('show-dropdown');
$(this).siblings('ul').toggleClass('show-dropdown');
});
- $('.button.dropdown', this).not('.split').on('click.fndtn', function (e) {
+
+ $doc.on('click.fndtn', '.button.dropdown:not(.split)', function (e) {
$('.button.dropdown', this).not(this).children('ul').removeClass('show-dropdown');
$(this).children('ul').toggleClass('show-dropdown');
});
- $('body, html').on('click.fndtn', function () {
+
+ $doc.on('click.fndtn', 'body, html', function () {
$('.button.dropdown ul').removeClass('show-dropdown');
});
-
+
// Positioning the Flyout List
var normalButtonHeight = $('.button.dropdown:not(.large):not(.small):not(.tiny)', this).outerHeight() - 1,
largeButtonHeight = $('.button.large.dropdown', this).outerHeight() - 1,
@@ -39,7 +49,7 @@
$('.button.dropdown.up.large > ul', this).css('top', 'auto').css('bottom', largeButtonHeight - 2);
$('.button.dropdown.up.small > ul', this).css('top', 'auto').css('bottom', smallButtonHeight - 2);
$('.button.dropdown.up.tiny > ul', this).css('top', 'auto').css('bottom', tinyButtonHeight - 2);
-
+
};
-})( jQuery );
+})( jQuery, this );
@@ -7,7 +7,7 @@
*/
(function( $ ){
-
+
/**
* Helper object used to quickly adjust all hidden parent element's, display and visibility properties.
* This is currently used for the custom drop downs. When the dropdowns are contained within a reveal modal
@@ -39,25 +39,25 @@
adjust : function( $child ) {
// Internal reference.
var _self = this;
-
+
// Set all hidden parent elements, including this element.
_self.hidden = $child.parents().andSelf().filter( ":hidden" );
-
+
// Loop through all hidden elements.
_self.hidden.each( function() {
-
+
// Cache the element.
var $elem = $( this );
-
+
// Store the style attribute.
// Undefined if element doesn't have a style attribute.
_self.tmp.push( $elem.attr( 'style' ) );
-
+
// Set the element's display property to block,
// but ensure it's visibility is hidden.
$elem.css( { 'visibility' : 'hidden', 'display' : 'block' } );
});
-
+
}, // end adjust
/**
@@ -96,7 +96,7 @@
jQuery.foundation = jQuery.foundation || {};
jQuery.foundation.customForms = jQuery.foundation.customForms || {};
-
+
$.foundation.customForms.appendCustomMarkup = function ( options ) {
var defaults = {
@@ -207,7 +207,7 @@
// Insert the the currently selected list item before all other elements.
// Then, find the element and assign it to $currentSelect.
//
-
+
$currentSelect = $customSelect.prepend( '<a href="#" class="current">' + $selectedOption.html() + '</a>' ).find( ".current" );
//
// Add the custom select element after the <select> element.
@@ -258,9 +258,9 @@
// Update the current element with the option value.
//
if ($currentSelect) {
- $currentSelect.html( this.value );
+ $currentSelect.html( $( this ).html() );
}
-
+
}
});
@@ -366,7 +366,7 @@
var $input = $element.prev(),
input = $input[0];
- if (false == $input.is(':disabled')) {
+ if (false === $input.is(':disabled')) {
input.checked = ((input.checked) ? false : true);
$element.toggleClass('checked');
@@ -378,36 +378,39 @@
var $input = $element.prev(),
input = $input[0];
- if (false == $input.is(':disabled')) {
- $('input:radio[name="' + $input.attr('name') + '"]').each(function () {
- $(this).next().removeClass('checked');
- });
- input.checked = ((input.checked) ? false : true);
- $element.toggleClass('checked');
+ if (false === $input.is(':disabled')) {
+
+ $('input:radio[name="' + $input.attr('name') + '"]').next().not($element).removeClass('checked');
+ if ($element.hasClass('checked')) {
+ // Do Nothing
+ } else {
+ $element.toggleClass('checked');
+ }
+ input.checked = $element.hasClass('checked');
$input.trigger('change');
}
};
- $('form.custom span.custom.checkbox').on('click', function (event) {
+ $(document).on('click', 'form.custom span.custom.checkbox', function (event) {
event.preventDefault();
event.stopPropagation();
toggleCheckbox($(this));
});
- $('form.custom span.custom.radio').on('click', function (event) {
+ $(document).on('click', 'form.custom span.custom.radio', function (event) {
event.preventDefault();
event.stopPropagation();
toggleRadio($(this));
});
- $('form.custom select').on('change', function (event) {
+ $(document).on('change', 'form.custom select[data-customforms!=disabled]', function (event) {
refreshCustomSelect($(this));
});
- $('form.custom label').on('click', function (event) {
+ $(document).on('click', 'form.custom label', function (event) {
var $associatedElement = $('#' + $(this).attr('for')),
$customCheckbox,
$customRadio;
@@ -424,15 +427,15 @@
}
});
- $('form.custom div.custom.dropdown a.current, form.custom div.custom.dropdown a.selector').live('click', function (event) {
+ $(document).on('click', 'form.custom div.custom.dropdown a.current, form.custom div.custom.dropdown a.selector', function (event) {
var $this = $(this),
$dropdown = $this.closest('div.custom.dropdown'),
$select = $dropdown.prev();
event.preventDefault();
$('div.dropdown').removeClass('open');
- if (false == $select.is(':disabled')) {
+ if (false === $select.is(':disabled')) {
$dropdown.toggleClass('open');
if ($dropdown.hasClass('open')) {
@@ -447,7 +450,7 @@
}
});
- $('form.custom div.custom.dropdown li').live('click', function (event) {
+ $(document).on('click', 'form.custom div.custom.dropdown li', function (event) {
var $this = $(this),
$customDropdown = $this.closest('div.custom.dropdown'),
$select = $customDropdown.prev(),
@@ -477,9 +480,9 @@
$select[0].selectedIndex = selectedIndex;
$select.trigger('change');
- });
-
-
+ });
+
+
$.fn.foundationCustomForms = $.foundation.customForms.appendCustomMarkup;
})( jQuery );
Oops, something went wrong.

0 comments on commit 3aba6fb

Please sign in to comment.