Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3241782
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:14:19+00:00 2026-05-17T18:14:19+00:00

I am trying to use jquery to do an animated scroll from one div

  • 0

I am trying to use jquery to do an animated scroll from one div to another. I am halfway there but can’t seem to get it to scroll on both axis. I have called the scrollto plugin and am open to using that. Here is the site live and the code: http://littleboxcreative.com/

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Little Box Creative</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="stylesheet" type="text/css" href="jqtransformplugin/jqtransform.css" />
<link rel="stylesheet" type="text/css" href="formValidator/validationEngine.jquery.css" />
<link rel="stylesheet" type="text/css" href="demo.css" />




<script type="text/javascript" src="js/jquery.jqtransform.js"></script>
<script type="text/javascript" src="js/jquery.validationEngine.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript" src="/js/jquery-ui.js"></script>
<script type="text/javascript" src="/js/jquery-scrollTo.js"></script>

<script type="text/javascript">
$(document).ready(function(){
  $('a[href*=#]').click(function() {
 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
 && location.hostname == this.hostname) {
   var $target = $(this.hash);
   $target = $target.length && $target
   || $('[name=' + this.hash.slice(1) +']');
   if ($target.length) {
  var targetOffset = $target.offset().top;
  $('html,body')
  .animate({scrollTop: targetOffset}, 1000);
    return false;
   }
 }
  });
});
</script>


</head>




<body>



<div id="main">
    <div id="mainwrap1">
    <div id="logo">
    </div>
    <div id="tagline">

        <div class="tagline1">
        </div>
    <div id="headline">
    </div>
    <a href="#mainwrap2">
        <div class="tagline2">
        </div>
    </a>    




    </div>
    </div>

    <div id="mainwrap2">





    </div>
</div>



<div id="body">
        <div id="services">

        </div>

        <div id="portfolio">

        </div>
    <div id="innerbody">
        <div id="welove">

        </div>
    </div>
</div>

</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T18:14:20+00:00Added an answer on May 17, 2026 at 6:14 pm

    $.scrollTo has an awesome demo page:
    http://demos.flesler.com/jquery/scrollTo/

    I noticed in your code above, you aren’t actually using $.scrollTo, but instead animating scrollTop.

    Instead of this:

    $('html,body').animate({scrollTop: targetOffset}, 1000);
    

    I would use the following, making $target the element you are trying to scroll to (you don’t have to worry about calculating its offset, and I think the default is to scroll on both axes):

    $.scrollTo($target, 1000);
    

    Or, if you want to be more verbose:

    $.scrollTo( $target, { duration: 1000, axis: 'xy' } );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use jQuery to get data from an ASP.NET web service (SharePoint
I'm trying to use jQuery .button() on a checkbox, but i can't understand why
I am trying to use jQuery .load() to get straight html from a asmx
I am trying to use jQuery's ajax functionality to update data from a web
I learned that by trying to use the tablesorter plug in from jquery the
I'm trying to use JQuery toggle functionality, but not able to use properly. Instead
I'm trying to use jquery to animate between two images, fading one out then
I'm trying to use jquery to create a tab effect for several div contents.
I'm trying use jquery to remove a class from an element (not knowing ahead
I'm trying to use jQuery's $(this) inside of Fancybox's onComplete event, but I'm running

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.