Skip to content

Instantly share code, notes, and snippets.

@smtm
Created April 13, 2011 16:41
Show Gist options
  • Save smtm/917886 to your computer and use it in GitHub Desktop.
Save smtm/917886 to your computer and use it in GitHub Desktop.
What is the best way to do onload Script execution?
// onLoad Syntax with calling jQuery in "Person"
jQuery(function() {
var cheight=$("#content").height();
var nheight=$("#navbar").height();
if (cheight>nheight) {
$("#navbar").height(cheight);
}
});
// same as above, more terse, we assume jQuery loaded
$(function() {
$('#topslider').do_stuff...;
});
// use this with Prototype
document.observe("dom:loaded", function() {
Site.adjustNavbar();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment