简体   繁体   中英

Dialog position

I am trying to change the left position for a dialog box created with jQuery, but it does not seems to recognize the new value; here is my code:

            $('#settype_dialog').dialog({
                                            autoOpen: true,
                                            width: 200,
                                            height: 200,
                                            show: 'bounce',
                                            hide: 'puff'
                                        }
            );
            $('#settype_dialog').css({"left", cX});
            $('#settype_dialog').dialog('option', 'title', 'Select Set Type');
            $('#settype_dialog').html(xml_text);
            $('#settype_dialog').dialog('open');    

Where cX is 130

Well, incorrect syntax looks to be the cause of your problem. The css() method of the jQuery object accepts either an object of key/value pairs where key is the property, or a property, value signature.

The two following ways would be equivalent:

$('#settype_dialog').css({"left": cX});

or

$('#settype_dialog').css("left", cX);

You need to append "px". cX + "px"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM