0

I am using ascensor.js on my website and I have a problem with jquery function scrollTop - it's doesn't work. I've tried different options but it still nothing happens. How to fix that?

// EDIT

Sorry. Here is the code.

I am using this simply function.

<a id="scrolltop"></a>

$(function () {
             $('#scrolltop').click(function () {
                 $('html, body').animate({
                     scrollTop: '0px'
                 },
                 1500);
                 return false;
             });
});

Now when I was included the ascensor.js it's just stopped working anymore.

1 Answers1

0

The one you have tried is normal jquery way, you are not using ascensor.js. Here is the both version and you can see the difference -

<head>
<script src="http://code.jquery.com/jquery-1.11.0.min.js" type="text/javascript"></script>
<script src="jquery.ascensor.min.js" type="text/javascript"></script>
</head>

Below is the body code, where for temporary I have used fixed 1000px to see scroll effect.

<div style="height:1000px;">Some text with fixed height</div>
<a id="scrolltop" style="float:right;width:100%" href="#">jquery-version</a>
<div style="height:20px;">&nbsp;</div>
<a id="ascensor" href="#">ascensor version</a>

<script type="text/javascript">
$(document).ready(function(){

    // attach jquery version to id scrolltop
    $('#scrolltop').click(function () {
        $('html, body').animate({
            scrollTop: '0px'
        },
        1500);
        return false;
    });

    // attach ascensor to id ascensor
    $('#ascensor').ascensor();

});
</script>

When you click on jquery-version thats not using ascensor and moves slowly as you are using animation. The other version is ascensor which by default do scroll top. The detail documentation and implementation example can give you other capabilities to move in any direction animation.

Mutant
  • 3,663
  • 4
  • 33
  • 53