Find file History
#7 Compare This branch is 5 commits ahead, 63 commits behind aliceui:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
minMax.html
readme.md

readme.md

min/max height/widget

  • 方法:这个东西还是用JS解决吧,除 min-height,CSS 方法还不是那靠谱:
    /* min-height /
    .min-height:200px;height:auto;
    _height:200px; / hack for ie6 */
    
  • JS 方法:

    max Height

    function setMaxHeight(elementId, height){
    var container = document.getElementById(elementId);
    container.style.height = (container.scrollHeight > (height - 1)) ? height + "px" : "auto";
    } 
    

    min Width

    function setMinWidth(elementId, width){
    var container = document.getElementById(elementId);
    container.style.width = (container.clientWidth < width) ? width + "px" : "auto";
    } 
     

    max Width

    function setMaxWidth(elementId, width){
    var container = document.getElementById(elementId);
    container.style.width = (container.clientWidth > (width - 1)) ? width + "px" : "auto";
    }