We help IT Professionals succeed at work.
Get Started

Large page with verticle and horizontal scrolling

Robert Granlund
on
309 Views
Last Modified: 2012-06-27
I would like to create a page that has a very large height and width.  On that page are various anchors that I would like to have javascript scroll to.

For example in this code, if you click on "Go To Hello Two"  the page would automatically shift/ smoothly scroll  to the left so Hello World Two was in the top Left hand corner.

<!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=iso-8859-1" />
<title>Untitled Document</title>
<style>
h2	{
	color:#fff;
}
</style>

<script src="http://code.jquery.com/jquery-1.7.js"></script>
</head>

<body>
<div style="width:2000px;">

<div style="width:1000px;height:500px;background-color:#fff;float:left;">
<h1>Hello World One</h1>
<br />
<br />
<a href="#helloTwo">Go To Hello Two</a>
</div>

<div style="width:1000px;height:500px;background-color:#000;float:right;">
<h2>Hello World Two</h2>
<br />
<br />
<a name="helloTwo" id="helloTwo">Hello Two</a>
</div>

</div>
</body>
</html>

Open in new window

Comment
Watch Question
Top Expert 2013
Commented:
This problem has been solved!
Unlock 1 Answer and 12 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE