trigger drop down menus on touch in mobile

This commit is contained in:
Bala Clark 2013-08-17 23:30:50 +02:00
parent ea42cb3ddc
commit 22402e640a
5 changed files with 29 additions and 10 deletions

View file

@ -102,6 +102,10 @@ var ComicBook = (function ($) {
var page_requested = false; // used to request non preloaded pages
var shiv = false;
if (navigator.userAgent.match(/mobile/i)) {
document.body.classList.add('mobile');
}
/**
* Gets the window.innerWidth - scrollbars
*/
@ -182,6 +186,13 @@ var ComicBook = (function ($) {
window.addEventListener('hashchange', checkHash, false);
}
window.addEventListener('touchstart', function (e) {
var $dropdown, $el = $(e.target);
if ($el.data('toggle') === 'dropdown' ) {
$el.siblings('.dropdown').toggle();
}
}, false);
/**
* Render Handlebars templates. Templates with data-trigger & data-action will
* have the specified events bound.