Solved

Cross browser scroll width when zoomed.

Posted on 2014-11-27
1
161 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 79

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
Several part series to implement Internet Explorer 11 Enterprise Mode
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.
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

770 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