Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add hover state support for desktop accordions.

  • Loading branch information...
commit 7bde8371b4fc4b7739c89078fa9ca2bbed89c91c 1 parent 439749e
@mrsweaters mrsweaters authored
View
4 test/elements.html
@@ -191,7 +191,7 @@ <h4 class="subheader">Prototyping and production requires more than just navigat
</div>
<br>
<div class="eight columns">
- <ul class="accordion">
+ <ul class="accordion hover">
<li class="active">
<div class="title">
<h5>Accordion Panel 1</h5>
@@ -374,7 +374,7 @@ <h4 class="subheader">Prototyping and production requires more than just navigat
<script src="../vendor/assets/javascripts/foundation/jquery.foundation.orbit.js"></script>
<script src="../vendor/assets/javascripts/foundation/app.js"></script>
<script type="text/javascript">
- $(document).tooltips({
+ $(document).foundationTooltips({
targetClass: '.has-tip-custom, .has-tip'
});
View
31 vendor/assets/javascripts/foundation/jquery.foundation.accordion.js
@@ -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');
+ });
});
- });
+ }
};
Please sign in to comment.
Something went wrong with that request. Please try again.