Solved

JAvascript to fix div vertically

Posted on 2012-04-11
3
281 Views
Last Modified: 2012-04-23
I have a div that is about 10000 pixels wide that scrolls back and forth horizontally.  In one Child Element I have a scrollbar that scrolls vertically.  however, this div class is positioned absolute within a parent element. it is generated by the jspScrollPane JS and I can't change that.  However, I was wondering, Is there a simple piece of Javascript that can fix a div class vertically but not horizontally? this would fix all of my problems.
0
Comment
Question by:rgranlund
3 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 37836175
Try this:

window,onscroll=function() {
  document.getElementById('largeDiv').style.left = "-"+document.body.scrollLeft+"px";
}
0
 

Expert Comment

by:akila111086
ID: 37836416
set the style to div

overflow: auto;
0
 
LVL 12

Expert Comment

by:Anuradha Goli
ID: 37836908
Set the vertical div with fixed height,width and set overflow attribute auto
<div style="height:50px;overflow:auto;width:500px">
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
The viewer will learn how to count occurrences of each item in an array.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now