开发者

Adjusting JS modal dialog to the browser window size

开发者 https://www.devze.com 2022-12-29 06:12 出处:网络
I wire up Shadowbox dialog provider to my links or button like this: <%=Html.ActionLink(Resources.Localize.Routes_WidgetsEdit, \"Edit\", Model.ContentType.ToString(),

I wire up Shadowbox dialog provider to my links or button like this:

    <%=Html.ActionLink(Resources.Localize.Routes_WidgetsEdit, "Edit", Model.ContentType.ToString(),
                                                  new {slug = Model.Slug, modal = true},
                                                  new
                                                    {
                                                        rel = "shadowbox;height=600;width=700",
                                                        title = Resources.Localize.Routes_WidgetsEdit,
                                                        @class = "editWidget"
                                                    })%>

As y开发者_如何学Cou can see, the values for dialog size are hardcoded. I want to have those two values dependant on the current size of the browser window but not entirely. I would like them to be like 80% or 90% percent.

How can I calculate this in JavaScript?


You could use jquery for this:

$(window).width();
$(window).height();
0

精彩评论

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

关注公众号