Solved

JAvascript to fix div vertically

Posted on 2012-04-11
3
287 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

717 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