Hi, the simplest cross-browser solution would be to use some additional plugin. For example, use this one:
http://stickyjs.com/
Usage would be super simple – you will just need to include the JS file on your page and add this code to initialize it:
$(function() {
$('#main-menu').sticky();
});
Let me know if you have any troubles.
Cheers!