Accessing dynamic property names in Jquery/Javascript

前端 未结 3 1730
不知归路
不知归路 2020-12-22 03:23

In a plugin I\'m writing, the dev can specify options, which I\'m storing and referencing like so:

(function( $, window) {
    $.widget(\"mobile.plug\", $.mo         


        
3条回答
  •  执笔经年
    2020-12-22 03:39

    You should be able to concatenate "Width" to the "panel" result:

    o[el.jqmData("panel") + "Width"]
    

    E.g., if el.jqmData("panel") is "menu" you would get o["menuWidth"].

提交回复
热议问题