Solved

JAvascript to fix div vertically

Posted on 2012-04-11
3
278 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

707 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

20 Experts available now in Live!

Get 1:1 Help Now