- This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
Viewing 8 posts - 1 through 8 (of 8 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Set a picture to dispaly on 80% of the screen width
I’m using the tinybox javascript code which basically opens up an image on the screen when a link is clicked.
The thing is, I can set the height and width of the picture in the javascript code, but I want it fit 80% of the user screen resolution so that it doesn’t become too larger on smaller screens.
Here is the code I’m working with:
Any one can help me, please?
var newHeight = window.innerHeight*0.8 + 'px',
newWidth = window.innerWidth*0.8 + 'px';
put these variables in for the height and width :D
Hmm I did it but it doesn’t seem to work.
Can you put the two bits of code together, maybe I did it in the wrong way or something… :P
If @karlpcrowley will allow me:
Cheers, that helped! :)
Thanks karlpcrowley.
Don’t forget to thank @Senff
:) :)
Anytime :)