使用自定义样式表与jquery ui

时间:2013-01-25 12:08:06

标签: jquery css jquery-ui stylesheet

我在我的asp.net MVC网站上使用jquery UI。在一个页面上,我单击一个按钮,然后打开一个新窗口作为window.open。新打开的窗口会在加载时打开Jquery UI弹出窗口。我将参数css传递给window.open。如果该参数不为空。我希望新打开的窗口的jquery弹出窗口能够使用该样式表。我的问题是如何将我的样式表用于jquery ui popup,因为jquery ui在css上使用自己的图像,而jquery ui css也使用这些样式名称。

请建议

1 个答案:

答案 0 :(得分:0)

您可以通过here滚动自己的主题,然后在弹出的layout.cshtml页面中对其进行编码

   <head>
        <meta charset="utf-8" />
        <title>@ViewBag.Title - My ASP.NET MVC Application</title>
        <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <meta name="viewport" content="width=device-width" />
        @Styles.Render("~/Content/css")
        @Scripts.Render("~/bundles/modernizr")

if (!string.isNullOrEmpty(Reuqest.QueryString["useCSS"])
{
@Styles.Render("~/Content/css/"+Reuqest.QueryString["useCSS"])
}

    </head>

但由于您没有提供任何代码,项目布局,描述等,我只假设您的意思是一个完整的弹出窗口而不仅仅是一个jquery.ui.dialog对象。

修改 此解决方案要求您为新主题创建bundler方法。

bundles.Add(new StyleBundle("~/Content/themes/base/css/themeName").Include(
                        "~/Content/themes/themeName/jquery.ui.core.css",
                        "~/Content/themes/themeName/jquery.ui.resizable.css",
                        "~/Content/themes/themeName/jquery.ui.selectable.css",
                        "~/Content/themes/themeName/jquery.ui.accordion.css",
                        "~/Content/themes/themeName/jquery.ui.autocomplete.css",
                        "~/Content/themes/themeName/jquery.ui.button.css",
                        "~/Content/themes/themeName/jquery.ui.dialog.css",
                        "~/Content/themes/themeName/jquery.ui.slider.css",
                        "~/Content/themes/themeName/jquery.ui.tabs.css",
                        "~/Content/themes/themeName/jquery.ui.datepicker.css",
                        "~/Content/themes/themeName/jquery.ui.progressbar.css",
                        "~/Content/themes/themeName/jquery.ui.theme.css"));