jqueryui ダイアログ ボックスを開いた後、その背景を変更しようとしています。背景色または画像はリンクをクリックした人に固有のものであるため、要件によりスタイルシートでこれを設定できません (背景値はデータベースから取得されます)。
ダイアログがロードされた後に次のjqueryコマンドを実行してdivのcssを変更すると、何もしませんか?
$("#modal_popup_website").css("background","red !important");
また
$("#modal_popup_website .ui-dialog-content").css("background","red !important");
また
$(".ui-dialog-content").css("background","red !important");
私は何を間違っていますか?
まず、次のようにダイアログを初期化します。
$("#modal_popup_website").dialog({
bgiframe: true,
autoOpen: false,
position: 'center',
width: $(window).width()-30,
minWidth: 990,
height: 900,
minHeight: 900,
modal: true,
stack: true, //Puts in front of other dialog's that may be open
open: function(){
},
close: function() {
//Save
}
次に、ユーザーが次のようなリンクをクリックすると、ダイアログが開きます。
$("#modal_popup_website").dialog("open");
開いた後、次のような HTML をダイアログ ボックスに入力します。
$("#modal_popup_website").html('gets loaded from external file');
外部ファイルの HTML は次のとおりです。
<div>some text</div>
<script type="text/javascript">
$("#modal_popup_website").css("background","red !important");
</script>
< script > 領域は、CSS の背景を変更しようとしている場所です。この外部 PHP ファイルで、このユーザーのデータベースから背景色または画像を取得し、ダイアログ ボックスの背景を変更したいのですが、うまくいきません。
どんなアイデアでも大歓迎です!
ありがとう。