Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Animate content on click Re: Animate content on click

#96093
jorveld
Member

@Mottie I understand you (it’s a 2 sec whait) completely but thats what I am stuck with (That’s what the customer wants). (btw external links are not animated).

My main question is if this is the best (fastest) way to achieve what I want. I already changed the code slightly:

css:

#content { display:none; }

js:

window.addEventListener(‘unload’, UnloadHandler, false);//back button FF and Safari

function UnloadHandler() {

//do nothing

}
var $content = $(‘#content’);

/*content fade in and out*/
$content.slideDown(1000);
$(‘#subnavext, #subinfo’).fadeIn(1000);

$(‘#menu a, #subinfo a, #postit a, #slider a, #sitemap a’).click( function(ev){
ev.preventDefault();
var $self=$(this);
$(‘#sitemap’).slideUp(800);
$(‘#subnavext, #subinfo, #postit’).fadeOut(1000);
$content.slideUp(1000, function(){
document.location = $self.attr(‘href’);
});
});

$(‘#subnavext a, #full-information a’).click( function(ev){
ev.preventDefault();
var $self=$(this);
$(‘#sitemap’).slideUp(800);
$content.slideUp(700, function(){
document.location = $self.attr(‘href’);
});
});