I want to set the jQuery dialog overlay on the image and can not cope with the task.
I have other dialogs on pages on which I do not want to have background images, so setting css for the overlay background will not work as a protective solution.
I tried many different methods and I believe that there is a problem of synchronizing with the jQuery command application to set the overlay using css and the actual div dialog and adding css to the DOM.
Here is what I have tried so far.
$('#submitUpload').click(function(){ $("#uploadStart").dialog('open'); $(".ui-widget-overlay").css({'background-image': 'url("http://www.mydomain.com/images/ftp-page-bg.gif")','opacity':'1'}) $("#uploadForm").submit(); });
OR
$("#uploadStart").dialog({ autoOpen: false, width: 400, modal: true, closeOnEscape: false, draggable: false, resizable: false, open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); $(".ui-widget-overlay").css({'background-image': 'url("http://www.mydomain.com/images/ftp-page-bg.gif")','opacity':'1'}) } });
I also tried using the dialogClass method in the dialog code without success.
Both with an absolute url, and with relative, and url in quotes or without quotes.
Image exists in the catalog.
Does anyone have any ideas on how to get jQuery to apply with the correct time to display the image as an overlay?
Thanks!
Update
The dialog class designation allows you to set the classes for the advanced dialog. I actually wanted to just click on a specific ui-widget-overlay class and move the background image. I found that trying to override the background using dialogClass worked to override the background of the dialog, rather than overlay the background.
When a dialog is added to the DOM, jQuery loads its div right before the body tag.
I found a solution, which is that in the open method for the dialog I used
$(".ui-widget-overlay").addClass('artFTP');
add class
.artFTP{background-image: url(../../images/ftp-page-bg.gif); opacity:1;}
and made sure that it was the last class in the file to overwrite the background image of the overlay.
Hope this helps someone.
Thanks and +1 for jjross, your answer made me return to jQuery docs.
If anyone has a better solution , send a message. I would be glad to see that. I think there might be a way to use CSS to accomplish the task, but (for my life) could not figure it out.