The DOM hasn't loaded yet. Wrap your code in a $(document).ready
:
$(document).ready(function () {
var config = {
over: function () { //onMouseOver callback (REQUIRED)
$('ul', this).slideDown(250);//show its submenu
},
timeout: 500, // milliseconds delay before onMouseOut (default 0)
out: function () { // function = onMouseOut callback (REQUIRED)
$('ul', this).slideUp(500); //hide its submenu
}
};
$('#nav li').hoverIntent(config);
});
You've configured JSFiddle to run your code onLoad
(see the configuration under "framework"). That's why it works in the fiddle.