Solved

Cross browser scroll width when zoomed.

Posted on 2014-11-27
1
152 Views
Last Modified: 2014-12-03
At this (http://htmldoodads.appspot.com/dimensions.html) link the the scrollbar width is calculated when you zoom it in or out.
But it is working only for chrome not  working for IE 9
I did not check the other browsers. Can anybody make this functions cross browser using pure JS?
Thank you..

The function is:


var outerDiv = document.createElement('div');
outerDiv.style.width = outerDiv.style.height = '500px';  // enough for all the scrollbars
var div = outerDiv;
for (var i = 0; i < 10; ++i) {
  var child = document.createElement('div');
  child.style.overflowY = 'scroll';
  div.appendChild(child);
  div = child;
}
document.body.appendChild(outerDiv);
var outerDivWidth = outerDiv.clientWidth;
var innerDivWidth = div.clientWidth;
var scrollbarWidthCss = (outerDivWidth - innerDivWidth)/10;
document.body.removeChild(outerDiv);
return scrollbarWidthCss;
0
Comment
Question by:myyis
1 Comment
 
LVL 78

Accepted Solution

by:
David Johnson, CD, MVP earned 500 total points
ID: 40469850
works with ie 9,10,11.. script error ie 8
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I had to do a bit of research to find the answer to this question so I thought I'd share my results.  Due to our outdated mainframe systems, we need to downgrade IE9 to IE8 in order to stay compatible.  We also needed to downgrade Java.  In order to…
I recently found myself in a Corporate Situation where the client had requested blocking access to any and all websites except his own Domain? Easy? I am sure this would be your answer but their requirement was, this has to be done without using…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

747 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