much cooler way of handling the options menu
parent
85bee11712
commit
1fb3dd87e3
19
main.js
19
main.js
|
@ -118,6 +118,7 @@ $(document).ready(function() {
|
|||
if (!el.hasClass('active')) {
|
||||
el.addClass('active');
|
||||
el.after('<div id="options-window"></div>');
|
||||
|
||||
$('div#options-window').load('./tabs/options.html', function() {
|
||||
googleAnalytics.sendAppView('Options');
|
||||
|
||||
|
@ -147,13 +148,21 @@ $(document).ready(function() {
|
|||
googleAnalyticsConfig.setTrackingPermitted(result);
|
||||
});
|
||||
|
||||
function close_and_cleanup(e) {
|
||||
if (!$.contains($('div#options-window')[0], e.target)) {
|
||||
$(document).unbind('click', close_and_cleanup);
|
||||
|
||||
$('div#options-window').slideUp(function() {
|
||||
el.removeClass('active');
|
||||
$(this).empty().remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(document).bind('click', close_and_cleanup);
|
||||
|
||||
$(this).slideDown();
|
||||
});
|
||||
} else {
|
||||
$('div#options-window').slideUp(function() {
|
||||
el.removeClass('active');
|
||||
$(this).empty().remove();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue