Getting values of global stylesheet in jQuery

后端 未结 4 1746
长发绾君心
长发绾君心 2020-12-12 04:58

When I use a style sheet definition like this on HTML page scope

#sideBar {
  float: left;
  width: 27.5%;
  min-width: 275;
  ... 
}

the f

4条回答
  •  旧时难觅i
    2020-12-12 05:06

    var width = ( 100 * parseFloat($("#sideBar").css('width')) / parseFloat($("#sideBar").parent().css('width')) ) + '%';
    

    reference get CSS rule's percentage value in jQuery

    here is the fiddle http://jsfiddle.net/jSGTs/

提交回复
热议问题