Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript jquery for setting a dynamic max-width

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #35226

    Uhm. Well i am really not well equipped with jquery knowledge therefore giving me the complete code would be the solution. =]

    The function will be
    1.get the 70% width of the browser’s screen.
    2.convert that width into its corresponding px value
    3.set the max width of the #mainContainer using the value got from the conversion/calculation.

    Need help thanks.
    here is the css style for the container i want to set max-width with.


    #mainContainer
    {
    background-image:url(bg3.jpg);
    background-repeat:repeat;
    background-color:#999;
    width:70%;
    padding:0;
    min-width:940px;/* 940px absolute value of 70%. *
    margin:0 auto;
    min-height:100%;
    /*serves as a divider from content to the main container*/
    -webkit-border-radius: 10px;
    border-radius: 10px;
    }
    #91733

    well yea it is but the purpose if this is to get the px version of the 70% of the window document so that i can use the value to set it to be the max width.

    #91759
    TheDoc
    Member

    But why don’t you just use 70%?

    <<< confused

    #91761
    davidlab.be
    Participant

    can i ask why? and for what purpose? the max-width would be 70% and that should be all you need for styling. Not sure why you would need the px version of 70%….they are the same. 70% of a page that is 1000px is 700px. 700px = 70%

    #92269

    im setting it to a static max width to limit its container in case the user zoom out the page. and all contents will then stay intact. if i plainly use percentage once the page is zoomed out contents go crazy.
    see here: http://dummyproto.atspace.co.uk/

    try zooming it out.

    #92321
    TheDoc
    Member

    Looks fine when zooming in and out for me.

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