I am relatively new to this question and was wondering if anyone could point me in the right direction! I am looking to enliven some aspects of page loading by clicking on menu links.
$("document").ready( function() {
$('.page_box_fade').css("display", "none")
.fadeIn('300');
$(".nav_image").click( function(){
$('.page_box_fade').fadeOut('300');
document.location = $(this).parent().attr("href");
return false;
});
});
This code works fine (ish), when I click on the ".nav_image" image that is contained in the link, it reduces the contents of the ".page_box_fade" div and is redirected to the "href" attribute from the .nav_image parent link click. Since there is a 300 ms attenuation, I would like the script to enable this before redirecting it to make the attenuation actually visible to the user.
$("document").ready( function() {
$(".nav_image").click( function(){
$('.page_box_fade').fadeOut('300');
setTimeout( "document.location = $(this).parent().attr('href')", 500 );
return false;
});
});
I assume that setTimeout will be the answer, but $ (this) .parent (). attr ('href') is undefined when used the way I thought.
html, :
<a href="?id=0">
<img class="nav_image" src="images/home.png" alt="home" />
</a>
:)