jquery - 将 Jquery Mobile ThemeRoller 的主题应用于 MVC4 移动应用程序

标签 jquery css asp.net-mvc-4 jquery-mobile jquery-mobile-themeroller

我刚刚使用 visual studio 2013 创建了一个 MVC4 移动应用程序。但是我不确定如何将 jquery mobile themeroller 主题应用于它。

我确实用我的自定义主题替换了现有的主题 css。它似乎根本不起作用。

找到下面的代码:

        bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));

        bundles.Add(new StyleBundle("~/Content/mobilecss").Include("~/Content/jquery.mobile*"));

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

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

我在这里错过了什么?

更新:

我无法以某种方式覆盖我使用 themerollers 创建的自定义主题。我没有尝试直接添加对文件的引用,如下所示。

<link rel="stylesheet" href="~/Content/jquery/jquery.mobile.theme-1.4.3.min.css" /> <!-- custom theme -->
<link rel="stylesheet" href="~/Content/jquery/jquery.mobile.icons.min.css" /> <!-- custom theme icon file -->
<link rel="stylesheet" href="~/Content/jquery.mobile-1.2.0.min.css" />
<link rel="stylesheet" href="~/Content/jquery.mobile.structure-1.2.0.min.css" />

在此之后,我添加了 JS 文件。当我添加数据主题属性以使用值“a”或“b”或“c”进行控制时,我得到默认颜色,而不是我在 themeroller 中在线的颜色。

最佳答案

您实际上还没有渲染您的主题包。您仍在呈现默认的 site.css。更改行:

@Styles.Render("~/Content/mobileCss", "~/Content/css")

收件人:

@Styles.Render("~/Content/mobileCss", "~/Content/themes/base/css")

关于jquery - 将 Jquery Mobile ThemeRoller 的主题应用于 MVC4 移动应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26974204/

相关文章:

javascript - 如何: dynamically load google ajax api into chrome extension content script

c# - MVC 发布数据并返回 json 数据

jquery - 如何使用 jQuery 和 ASP.NET MVC 支持带有循环引用的 JSON?

javascript - 为什么我的插件不加载它的依赖项?

jquery - 尝试绑定(bind) alt gr 键,但在 chrome 中不起作用

jQuery 用输入值填充 Div ID

javascript - 如何避免 HTML 页面中的 CSS 干扰

javascript - 如何在窗口滚动时为导航栏设置动画

c# - 如何在选择另一个@Html.DropDownList 后填充@Html.DropDownList

c# - SignalR:如何在页面重新加载时停止创建新连接