Created
February 4, 2014 20:19
-
-
Save joshuakfarrar/8811530 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var opened = true // toggle | |
, map_width | |
, side_panel_width | |
, OPEN_SIDEBAR_WIDTH = 30 | |
, MAX_MAP_WIDTH = 100 | |
var self = this; | |
$("#toggle").on('click', function() { | |
var close_it = function () { | |
self.map_width = MAX_MAP_WIDTH; // should be a constant | |
self.side_panel_width = MAX_MAP_WIDTH - MAX_MAP_WIDTH; | |
return false; | |
} | |
, open_it = function () { | |
self.map_width = MAX_MAP_WIDTH - OPEN_SIDEBAR_WIDTH; | |
self.side_panel_width = OPEN_SIDEBAR_WIDTH; | |
return false; | |
} | |
if (!opened) open_it() | |
else close_it() | |
$("#map").animate({'width': self.map_width.toString() + '%'}, 300); | |
$("#side_panel").animate({'width': self.side_panel_width.toString() + '%'}, 300); | |
opened = !opened; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment