Solved

Cross browser scroll width when zoomed.

Posted on 2014-11-27
1
172 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
[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
1 Comment
 
LVL 81

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.
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 +…

688 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