2

Change the height of division according to the internal height of Windows

 2 years ago
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.
neoserver,ios ssh client

Change the height of division according to the internal height of Windows

advertisements

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

How to resize (and change the possition) of a window of other application programically? I would like to code with Java, and I want to resize all windows, not only those which are created by JVM. I'm using Windows XP. I would like to change other pro

htaccess Redirect to the same file, but display the different URL without having to change the internal links?

I currently have links on my website in the form of:- http://example.com/products.php?cat=X I want that once taken to the destination of the link, the url displays something like:- http://example.com/new. The file on my server is the same file, but o

How to change the size of Emacs windows with split screen?

I have emacs split horizontally - on top I'm editing Perl code, the bottom is the shell. By default emacs makes the two windows equal in size, but I'd like the shell buffer smaller (maybe half the size?). I was wondering how I could do that.With the

Changing the Start Page on Windows Phone / PhoneGap 1.7

I'd like to load a different HTML file than the index.html on startup in my PhoneGap 1.7 project for Windows Phone. Unfortunately I can't seem to find where I can change that. Any help? CheersYour MainPage.xaml.cs contains the MainPage constructor. W

Changing the JRadioButton icon on Windows 7

I created a method which changes the icon of all jradiobuttons from a buttongroup: public void setRadioButtonIcons(final ButtonGroup gruppe){ Enumeration<AbstractButton> gruppeEnum = gruppe.getElements(); while (gruppeEnum.hasMoreElements()){ Abstra

How do I change the resolution of a window in SDL? Everything is too big

I am making a game in SDL and had an oversight of the resolution. Everything (the sprites) are too large and I want to know if I can bump up the resolution so everything is smaller without changing every sprite or modifying how the surfaces are creat

Change the pinned taskbar icon (Windows 7)

I wan't to customize the icon displayed within the windows 7 taskbar. When my app is running, I can do it by changing main window icon but, when the app is pinned, the exe's icon is displayed. How can I set the taskbar icon for my app to an icon diff

Changing the service startup type (Windows)

I was searching for ways to change the start-up type of a Windows service and I found 2 ways to do this... By editing the Registry Or By using the WMI classes I want to know which one is the best... I want my application to run properly on both Windo

Change the initial directory in windows powershell

I'm using windows powershell for an application of my project. I'd like to change the initial directory, that I find when I open the program. I'd like to have my project's directory. Is this possible?If I understood your question correctly, you want

Unable to change the PowerShell font and window size on Windows 8.1

My PowerShell window opens with a very small font (and window size). This is a common problem, and I found a bunch of suggestions for how to deal with it, but none of the suggestions seem to work. Specifically, the common suggestion that one should o

Changing the internal table function in C

I am learning C and confused why a array created in the main wont change inside the function, i am assuming the array passed is a pointer, and changing the pointer should've change the array , right ? can someone explain what is happening in this cas

Change the location of special Windows folders by program

How do I change the windows special folders location? (On Win7, Preferably using C#). Basically trying to do what the windows interface allows us to do, but programmatically. (See image) On top of changing the location it should also move any existin

What is the best way to change the credentials of a Windows service by using C #

I need to change the credentials of an already existing Windows service using C#. I am aware of two different ways of doing this. ChangeServiceConfig, see ChangeServiceConfig on pinvoke.net ManagementObject.InvokeMethod using Change as the method nam

change the default voice on Windows 7 via C # code

I need to change the windows 7 current default voice (Microsoft Anna and an extra German voice is installed) via C# code. As I am a beginner programmer, it will be difficult for me to find it out on my own. Any ideas how I can achieve it? Thank you a

Changing the SetTimer resolution on Windows

I have an application, written with Qt 4.8, that uses Qt's timer facilities to trigger periodic events at regular intervals (via QObject::startTimer(), with events posted to the owning QThread's message queue). Qt sets up timers on Windows by ultimat

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK