Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如:
<div id="target" data-width="400px"></div> $("#target").myPlugin({width: ??? });
???必须是data-width属性值。
data-width
$("#target").myPlugin({width: $("#target").attr('data-width') });
你可以这样做
$("#target").myPlugin({ width: $("#target").data('width') });
所有功劳归于adeno
http://api.jquery.com/width/
您可以使用 .width() 轻松获得 leh 宽度