开发者

jquery ui dialog - open when page loads if browser is ie

开发者 https://www.devze.com 2023-04-10 09:22 出处:网络
I have a jQuery UI di开发者_运维百科alogue but need it to open as soon as the page is loaded if the browser is ie (Internet Explorer). I have made the dialogue, but cannot seem to find anywhere in the

I have a jQuery UI di开发者_运维百科alogue but need it to open as soon as the page is loaded if the browser is ie (Internet Explorer). I have made the dialogue, but cannot seem to find anywhere in the API Documentation to open a dialogue on load.


Just attach a normal $(window).load() handler but wrap it in a conditional comment:

<!--[if IE]>
    <div id="ie-dialog">...</div>
    <script type="text/javascript">
        $(window).load(function() {
            $('#ie-dialog').dialog();
        });
    </script>
<![endif]-->

You could also wait until the DOM is ready if you need it:

<!--[if IE]>
    <div id="ie-dialog">...</div>
    <script type="text/javascript">
        $(document).ready(function() {
            $('#ie-dialog').dialog();
        });
    </script>
<![endif]-->


$(function() {
    if(jQuery.browser.msie) {
        $("#dialog").dialog();
    }
});

You can find more in documentation for jQuery.browser

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号