![](/img/trans.png)
[英]How to change the dimensions of a div depending of a number extern to that div? jquery/css
[英]Jquery css left change of image depending on div width
我有一個JSON提要動態輸入的內容,該JSON提要使用不同長度的各種名稱填充div。
存在已設置為無法更改的絕對位置的圖像。 盡管我需要將圖片的CSS左值動態地更改為+ 10px
的動態文本的寬度。
var _origin_width = $('#dynamic_text').width() + $('#the_imae').width();
所以他們像這樣並排
Dynamic Text | Image
我很難讓它正常工作。
嘗試這個:
//get the width of content +10 in px
var dynamic_width = $('#dynamic_text').width()+10+'px';
//now set the css
$('#the_imae').css('left',dynamic_width)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.