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

35 lines
726 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-11-07 20:25:08 +00:00
init: function() {
var self = Mobile
2016-11-07 20:25:08 +00:00
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()
},
2016-11-07 20:25:08 +00:00
resizeTitle: function() {
// the 70 relates to padding
$('#header_content').width($(document).width() - 70)
2016-08-12 04:04:18 +00:00
},
2016-11-07 20:25:08 +00:00
liClick: function() {
var self = Mobile
2016-08-12 04:04:18 +00:00
$('#header_content').html($(this).text())
self.toggleMenu()
},
2016-11-07 20:25:08 +00:00
toggleMenu: function() {
$('#mobile_menu').toggleClass('visible')
2016-08-12 04:04:18 +00:00
},
2016-11-07 20:25:08 +00:00
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