Change the height of division according to the internal height of Windows
source link: https://www.codesd.com/item/change-the-height-of-division-according-to-the-internal-height-of-windows.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Change the height of division according to the internal height of Windows
I need a little help here.
I want to change the height of div according to the screen inner height for which i have written a java script which is as follows
<script>
function height()
{
var h = window.innerHeight;
document.getElementById("bg").style.height = h;
}
</script>
Whenever i use
document.getElementById("bg").style.height = h;
i doesn't write anything to the div element #bg but when i define a height in px like 500px i does write height in div element #bg.
You'll need to add 'px' to the height value:
function height()
{
var h = window.innerHeight;
document.getElementById("bg").style.height = h+'px';
}
And obviously call the function at some point
height();
Check out the fiddle - http://jsfiddle.net/MRttV/
Related Articles
How to resize programmatically and change the position of a window
htaccess Redirect to the same file, but display the different URL without having to change the internal links?
How to change the size of Emacs windows with split screen?
Changing the Start Page on Windows Phone / PhoneGap 1.7
Changing the JRadioButton icon on Windows 7
How do I change the resolution of a window in SDL? Everything is too big
Change the pinned taskbar icon (Windows 7)
Changing the service startup type (Windows)
Change the initial directory in windows powershell
Unable to change the PowerShell font and window size on Windows 8.1
Changing the internal table function in C
Change the location of special Windows folders by program
What is the best way to change the credentials of a Windows service by using C #
change the default voice on Windows 7 via C # code
Changing the SetTimer resolution on Windows
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK