Skip to content

Instantly share code, notes, and snippets.

@yitwail
Created November 17, 2013 22:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yitwail/7519239 to your computer and use it in GitHub Desktop.
Save yitwail/7519239 to your computer and use it in GitHub Desktop.
changes to js/custom.js for iPad dropdown menu support
// apply fitvids functionality to .entry-content div
// https://github.com/davatron5000/FitVids.js
jQuery(document).ready(function($) {
$(".entry-content").fitVids();
});
// modified version of flexnav, does not have drop down functionality
// https://github.com/indyplanets/flexnav
// http://webdeveloper2.com/2011/06/trigger-javascript-on-css3-media-query-change/
jQuery(document).ready(function($) {
detector = jQuery('.js');
compareWidth = detector.width();
smallScreen = '768';
menuButton = $('.menu-button');
menuButton.click(function() {
if (!$(".access-nav").is(":visible"))
menuButton.addClass("nav-open");
$(".access-nav").slideToggle('slow', function() {
if (!$(".access-nav").is(":visible"))
menuButton.removeClass("nav-open");
});
});
//http://stackoverflow.com/questions/15815513/hover-behavior-on-desktop-vs-ipad
//http://benfrain.com/beginner-and-designers-guide-to-using-modernizr-to-solve-cross-browser-challenges/
if (Modernizr.touch) {
$('#access .sf-menu > li.has-flyout > a').on('click', function() {
if (menuButton.is(":visible") || $(this).hasClass('hover'))
return true;
$(this).addClass('hover').parent().siblings('.has-flyout').children('a').removeClass('hover');
return false;
});
}
$(window).resize(function(){
if (detector.width()!=compareWidth) {
compareWidth = detector.width();
if (compareWidth >= smallScreen) {
$('.access-nav').show();
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment