Jump to content

[SOLVED] Anyone know what js/jQuery file is used for back-top?


sshare

Recommended Posts

As per the title, does anyone know which js or jQuery file is used for the back-top <p> tag.

 

I had it on another theme, and copied the code to my new theme, it all appears fine, but for some reason the button is now appearing all the time, so a script must be missing some code or something.

 

This is the <p> tag:

 

<p id="back-top"> <a href="#top"><span></span></a> </p>

 

Has anyone tried this? (Btw I got it working on a another theme by simply adding the <p> tag and the corresponding CSS, Ive done the same and the back to top button always appears and there is no scrolling effect.

Edited by sshare (see edit history)
Link to comment
Share on other sites

I was right in that Im missing some script, but wasnt looking in the correct place.

 

Guess Im tired, forgot to add the following jQuery,

 

 

This is what I was missing to make it work.

 

 

<script type="text/javascript"> Cufon.now(); </script>

<script>

jQuery(document).ready(function(){

// hide #back-top first

jQuery("#back-top").hide();

// fade in #back-top

jQuery(function () {

jQuery(window).scroll(function () {

if (jQuery(this).scrollTop() > 100) {

jQuery('#back-top').fadeIn();

} else {

jQuery('#back-top').fadeOut();

}

});

 

// scroll body to 0px on click

jQuery('#back-top a').click(function () {

jQuery('body,html').animate({

scrollTop: 0

}, 800);

return false;

});

});

 

});

</script>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...