0
我有一個擴展到父我如何獲得的fancybox幀的寬度,當它完成加載
$.fancybox.open({width:95%, ...
是它在所有可能得到任何彈出框的寬度的95%的fancybox彈出或父(我需要在彈出框內),因爲當圖像很大時,我需要調整屏幕的一部分以保持具有設置寬度的圖像。
我有一個擴展到父我如何獲得的fancybox幀的寬度,當它完成加載
$.fancybox.open({width:95%, ...
是它在所有可能得到任何彈出框的寬度的95%的fancybox彈出或父(我需要在彈出框內),因爲當圖像很大時,我需要調整屏幕的一部分以保持具有設置寬度的圖像。
您可以使用$(this).parent()選擇其父項,然後詢問其寬度。
//This will give you the outer width
$("#fancyBox_Container").outerWidth();
//This will give you parent outer width, in place of id, you can give direct element id or class name
$("#fancyBox_Container").parents().outerWidth();