I don't support Internet Explorer 6 & below because of it's complete lack of basic web standards. I'd strongly advise you to download Firefox, Safari, or at least IE8.
I don't support Internet Explorer 6 & below because of it's complete lack of basic web standards. Your cutting it pretty close by using IE7, I'd strongly advise you to download Firefox, Safari, or at least IE8.
As you have probably noticed, if you scroll down far enough on my blog a little button fades in & you can click it to go back to the top of the page. I accomplished this using jQuery & two plugins. The first one, that does most of what we want was made my David Walsh. The second one, that actually scrolls back up was, made by Ariel Flesler.
Ok, we want to make a link that fades in as you scroll down & then brings you back to the top of the page right? It's just a little nicety that's not really appropriate on every site so I'll let you be the judge on whether or not it is for your site.
Right, so the first thing you'll want to do is get both of the plugins I mentioned above installed along with the jQuery library. Next you'll need to make a anchor with a href to a blank div at the top of your page, or something at the very top of the page… Ex: #logo-div.
Realistically, you'll have your own CSS but this just what I had.
a#top {
display: none;
position: fixed;
right: 10px;
bottom: 10px;
color: #fff;
font: normal bold 12px Helvetica;
text-decoration: none;
background: #888;
padding: 5px 10px;
}
a#top:hover {
background: #111;
}
This the real meat & bones of the effect here.
$(document).ready(function() {
$('#top').topLink({
min: 400,
fadeSpeed: 500
});
$('#top').click(function(e) {
e.preventDefault();
$.scrollTo(0,300);
});
});
Post a Comment