Solved

JAvascript to fix div vertically

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses four methods for overlaying images in a container on a web page
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…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

813 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

12 Experts available now in Live!

Get 1:1 Help Now