Skip to content

Instantly share code, notes, and snippets.

@csessig86
Created May 6, 2013 23:35
Show Gist options
  • Save csessig86/5529158 to your computer and use it in GitHub Desktop.
Save csessig86/5529158 to your computer and use it in GitHub Desktop.
Responsive maps blog 4
// Toggle for 'About this map' and X buttons
// Only visible on mobile
isVisibleDescription = false;
// Grab header, then content of sidebar
sidebarHeader = $('#sidebar_header').html();
sidebarContent = $('#sidebar_content').html();
// Then grab credit information
creditsContent = $('#credits_content').html();
$('.toggle_description').click(function() {
if (isVisibleDescription === false) {
$('#description_box_cover').show();
// Add Sidebar header into our description box
// And 'Scroll to read more...' text on wide mobile screen
$('#description_box_header').html(sidebarHeader + '<div id="scroll_more"><strong>Scroll to read more...</strong></div>');
// Add the rest of our sidebar content, credit information
$('#description_box_content').html(sidebarContent + '<br />' + 'Credits:' + creditsContent);
$('#description_box').show();
isVisibleDescription = true;
} else {
$('#description_box').hide();
$('#description_box_cover').hide();
isVisibleDescription = false;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment