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
Solved

JAvascript to fix div vertically

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…

856 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