metamaps--metamaps/frontend/src/Metamaps/Mobile.js

35 lines
721 B
JavaScript
Raw Normal View History

2016-09-22 09:36:47 +00:00
/* global $ */
2016-08-12 04:04:18 +00:00
2016-09-22 09:36:47 +00:00
import Active from './Active'
import Map from './Map'
const Mobile = {
2016-08-12 04:04:18 +00:00
init: function () {
var self = Mobile
2016-08-12 04:04:18 +00:00
$('#menu_icon').click(self.toggleMenu)
$('#mobile_menu li a').click(self.liClick)
$('#header_content').click(self.titleClick)
self.resizeTitle()
},
resizeTitle: function () {
// the 70 relates to padding
$('#header_content').width($(document).width() - 70)
2016-08-12 04:04:18 +00:00
},
liClick: function () {
var self = Mobile
2016-08-12 04:04:18 +00:00
$('#header_content').html($(this).text())
self.toggleMenu()
},
toggleMenu: function () {
$('#mobile_menu').toggle()
},
titleClick: function () {
2016-09-22 09:36:47 +00:00
if (Active.Map) {
Map.InfoBox.open()
2016-08-12 04:04:18 +00:00
}
}
}
export default Mobile