Permalink
Browse files

Updated for version 3.2 of foundation

  • Loading branch information...
1 parent 7cb0824 commit d847aebdc6c2db0816bc7c8c53603aff00d58db1 ModLearning Team committed Nov 1, 2012
View
@@ -0,0 +1,29 @@
+/* Artfully masterminded by ZURB */
+
+/* --------------------------------------------------
+ Table of Contents
+-----------------------------------------------------
+:: Shared Styles
+:: Page Name 1
+:: Page Name 2
+*/
+
+
+/* -----------------------------------------
+ Shared Styles
+----------------------------------------- */
+
+
+
+/* -----------------------------------------
+ Page Name 1
+----------------------------------------- */
+
+
+
+
+/* -----------------------------------------
+ Page Name 2
+----------------------------------------- */
+
+
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -19,15 +19,15 @@
$.fn.foundationTopBar ? $doc.foundationTopBar() : null;
-
+ $.fn.foundationCustomForms ? $doc.foundationCustomForms() : null;
$.fn.foundationMediaQueryViewer ? $doc.foundationMediaQueryViewer() : null;
- $.fn.foundationTabs ? $doc.foundationTabs() : null;
+ $.fn.foundationTabs ? $doc.foundationTabs() : null;
- $("#featured").orbit();
+ $("#featured").orbit();
// UNCOMMENT THE LINE YOU WANT BELOW IF YOU WANT IE8 SUPPORT AND ARE USING .block-grids

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -2,15 +2,32 @@
'use strict';
$.fn.foundationAccordion = function (options) {
+ var $accordion = $('.accordion');
- $('.accordion li', this).on('click.fndtn', function () {
- var p = $(this).parent(); //changed this
- var flyout = $(this).children('.content').first();
- $('.content', p).not(flyout).hide().parent('li').removeClass('active'); //changed this
- flyout.show(0, function () {
- flyout.parent('li').addClass('active');
+ if ($accordion.hasClass('hover') && !Modernizr.touch) {
+ $('.accordion li', this).on({
+ mouseenter : function () {
+ console.log('due');
+ var p = $(this).parent(),
+ flyout = $(this).children('.content').first();
+
+ $('.content', p).not(flyout).hide().parent('li').removeClass('active'); //changed this
+ flyout.show(0, function () {
+ flyout.parent('li').addClass('active');
+ });
+ }
+ });
+ } else {
+ $('.accordion li', this).on('click.fndtn', function () {
+ var p = $(this).parent(),
+ flyout = $(this).children('.content').first();
+
+ $('.content', p).not(flyout).hide().parent('li').removeClass('active'); //changed this
+ flyout.show(0, function () {
+ flyout.parent('li').addClass('active');
+ });
});
- });
+ }
};
@@ -1,37 +1,56 @@
;(function ($, window, undefined) {
'use strict';
- $.fn.foundationButtons = function(options) {
- var $doc = $(document);
+ $.fn.foundationButtons = function (options) {
+ var $doc = $(document),
+ config = $.extend({
+ dropdownAsToggle:true,
+ activeClass:'active'
+ }, options),
+
+ // close all dropdowns except for the dropdown passed
+ closeDropdowns = function (dropdown) {
+ $('.button.dropdown').find('ul').not(dropdown).removeClass('show-dropdown');
+ },
+ // reset all toggle states except for the button passed
+ resetToggles = function (button) {
+ var buttons = $('.button.dropdown').not(button);
+ buttons.add($('> span.' + config.activeClass, buttons)).removeClass(config.activeClass);
+ };
+
// Prevent event propagation on disabled buttons
$doc.on('click.fndtn', '.button.disabled', function (e) {
e.preventDefault();
});
$('.button.dropdown > ul', this).addClass('no-hover');
- $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();
- }
- });
-
- $doc.on('click.fndtn', '.button.dropdown.split span', function (e) {
+ // reset other active states
+ $doc.on('click.fndtn', '.button.dropdown:not(.split), .button.dropdown.split span', function (e) {
+ var $el = $(this),
+ button = $el.closest('.button.dropdown'),
+ dropdown = $('> ul', button);
e.preventDefault();
- $('.button.dropdown', this).not($(this).parent()).children('ul').removeClass('show-dropdown');
- $(this).siblings('ul').toggleClass('show-dropdown');
- });
- $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');
+ // close other dropdowns
+ closeDropdowns(config.dropdownAsToggle ? dropdown : '');
+ dropdown.toggleClass('show-dropdown');
+
+ if (config.dropdownAsToggle) {
+ resetToggles(button);
+ $el.toggleClass(config.activeClass);
+ }
});
- $doc.on('click.fndtn', 'body, html', function () {
- $('.button.dropdown ul').removeClass('show-dropdown');
+ // close all dropdowns and deactivate all buttons
+ $doc.on('click.fndtn', 'body, html', function (e) {
+ // check original target instead of stopping event propagation to play nice with other events
+ if (!$(e.originalEvent.target).is('.button.dropdown:not(.split), .button.dropdown.split span')) {
+ closeDropdowns();
+ if (config.dropdownAsToggle) {
+ resetToggles();
+ }
+ }
});
// Positioning the Flyout List
Oops, something went wrong.

0 comments on commit d847aeb

Please sign in to comment.