Forums

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

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #37114
    Al3ks
    Participant

    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?

    #98859
    karlpcrowley
    Participant
    var newHeight = window.innerHeight*0.8 + 'px',
    newWidth = window.innerWidth*0.8 + 'px';

    put these variables in for the height and width :D

    #98860
    Al3ks
    Participant

    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

    #98861
    Senff
    Participant

    If @karlpcrowley will allow me:

    #98862
    Al3ks
    Participant

    Cheers, that helped! :)
    Thanks karlpcrowley.

    #98863
    karlpcrowley
    Participant

    Don’t forget to thank @Senff
    :) :)

    #98867
    Al3ks
    Participant

    Thank you @Senff :) :)

    #98869
    Senff
    Participant

    Anytime :)

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.