How can I shorten and optimize this code which displays then hides a DIV?setTimeout(function () {    $('.updateNotification').show().addClass('heightener');    callback();},2000)function callback() {  setTimeout(function() {    $( '.updateNotification' ).fadeOut();  }, 10000 );};My first thought was to combine the functions. However, I would like them to remain separate because at a later date I will additionally incorporate a button which will trigger callback() in addition to the timer.
jQuery function that modifies a DIV
javascript;performance;jquery
I'm not sure how you would shorten this code. However I think that callback is a terrible name for a function that fades a CSS class. Remember that a function signature should represent what a function does and with that said I would rename it to something like fadeUpdateNotification().And in the fashion of fading you could replace .show() with .fadeIn() to have the div fade in and out - I dunno how your styling/website looks like but that might look nice...