JQuery DatePicker 和 ThemeRoller 发生冲突

发布于 2024-12-16 02:50:36 字数 1335 浏览 1 评论 0原文

我用一个有效的 JQuery 日期选择器制作了一个页面(ASP.NET MVC3 和 razor 视图)。或者至少在我使用 themeswitcher 小部件 切换主题之前它会起作用。切换主题后,我调出日期选择器,小部件的标题如下所示:

Prev Next
August
...as usual...

不幸的是,大约一秒钟内,标题就损坏了; “上一页下一页”文本与左、右、上、下箭头的图像带叠加。日期选择器工作正常,但其标题是混乱的文本和图像。我认为也许我自己的网站样式与 jquery 冲突,所以我完全删除了所有样式。但问题仍然存在。

当我将损坏的日期选择器与 jquery 网站上的 示例 进行比较时,我看到其中两个相同的箭头图像显示在标题,在月份的两侧,如下所示:

<- August ->

这样我就可以看到箭头是如何渲染的。我还可以看到“上一页下一页”一词从未出现。

要了解这个示例的基本结构,我的 head 元素如下所示:

<head>
<meta charset="utf-8" />
<title>@ViewBag.Title</title>
<script src="@Url.Content("~/Scripts/jquery-1.7.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/modernizr-2.0.6-development-only.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.16.js")" type="text/javascript"></script>
<script type="text/javascript">
  $(document).ready(
      function () {
          $("#MaxAge").datepicker();
          $('#switcher').themeswitcher();
      });
</script>
</head>

这些糟糕的结果同时出现在 IE 9 和 Chrome 上。我做错了什么?

I've made a page (ASP.NET MVC3 and razor view) with a working JQuery datepicker. Or at least it works until I switch my theme with the themeswitcher widget. With the theme switched, I then bring up the date picker, and the widget has a heading something like this:

Prev Next
August
...as usual...

Unfortunately within about a second, the heading becomes corrupted; The 'Prev Next' text is superimposed with an image ribbon of left, right, up, down arrows. The datepicker works correctly, but its header is jumbled text and images. I thought perhaps my own site styling was conflicting with jquery, so I removed all of my styling entirely. Yet the problem persisted.

When I compare my broken datepicker with a sample on the jquery site, I see two of those same arrow images showing in the header, on either side of the month like this:

<- August ->

So I can see how the arrows were meant to be rendered. I can also see the words "Prev Next" never appear.

To see how bare bones this example is, here is what my head element looks like:

<head>
<meta charset="utf-8" />
<title>@ViewBag.Title</title>
<script src="@Url.Content("~/Scripts/jquery-1.7.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/modernizr-2.0.6-development-only.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.16.js")" type="text/javascript"></script>
<script type="text/javascript">
  $(document).ready(
      function () {
          $("#MaxAge").datepicker();
          $('#switcher').themeswitcher();
      });
</script>
</head>

These bad results occur on both IE 9 and Chrome. What am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏日浅笑〃 2024-12-23 02:50:36

我知道这是一个老问题。我发现它是因为我有同样的问题。主题切换器似乎与日期选择器不兼容。我删除了它并将主题添加到我的网站,日期选择器开始正常显示。

我怀疑您必须将主题更新为您正在使用的 jqueryui 的同一版本,在我的情况下,主题切换器仍在提供最后一个版本。

I know this is an old question. I found it because I had the same issue. The Themeswitcher seems to not be compatible with the datepicker. I removed it and added themes to my site and the datepicker started displaying properly.

I suspect that you have to update the themes to the same version of jqueryui that you're using and in my case the themeswitcher was still serving up the last version.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文