Javascript JQuery UI datepicker如何显示月份导航的下一个上一个箭头?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2244082/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-22 23:26:22  来源:igfitidea点击:

JQuery UI datepicker how to show next prev arrows for month navigation?

javascriptjquery-uidatepicker

提问by Malcolm

Exactly as the title says.

正如标题所说的那样。

When I load the datepicker there is nothing on the ends to click onto change month.

当我加载日期选择器时,末端没有任何东西可以点击更改月份。

But you can stil change the month just no visual??

但是您仍然可以更改月份,只是没有视觉效果??

回答by dxh

Sounds like the graphics aren't being loaded properly. By default jQuery UI expects the folder with images to be a subfolder of the folder where the css file is. Use a tool such as firebug ('Net' tab) to detect the requests for the image with the arrows, and see what URL it's trying to load it from.

听起来图形没有正确加载。默认情况下,jQuery UI 期望带有图像的文件夹是 css 文件所在文件夹的子文件夹。使用诸如 firebug(“Net”选项卡)之类的工具来检测对带有箭头的图像的请求,并查看它试图从哪个 URL 加载它。

回答by Gabriel

Sounds like your theme is not complete, make sure you're loading the month change option correctly.

听起来您的主题不完整,请确保您正确加载了月份更改选项。

$( ".date" ).datepicker({ changeMonth: true });

or

或者

$( ".date" ).datepicker( "option", "changeMonth", true );

and check the CSS is being found correctly, you can use firebug to inspect the files called and not found in the "NET" tab

并检查是否正确找到了 CSS,您可以使用 firebug 检查在“NET”选项卡中调用但未找到的文件

回答by macio.Jun

Short answer. You didn't load images provided by jquery ui theme. open console in either chrome or firefox, where you will be told which images and where you should put your images.

简短的回答。您没有加载 jquery ui 主题提供的图像。在 chrome 或 firefox 中打开控制台,您将被告知哪些图像以及您应该将图像放在哪里。

回答by Obay

I also stumbled upon this problem.

我也偶然发现了这个问题。

What I did was, I just re-downloaded the theme. It turned out the images in my theme folder were corrupted.

我所做的是,我只是重新下载了主题。原来我的主题文件夹中的图像已损坏。

回答by triplethreat77

I'm having a similiar problem. I can change the months, but the arrows aren't visible. even if i give a style within the page to override. Strange, because they work on other pages.

我遇到了类似的问题。我可以更改月份,但箭头不可见。即使我在页面中提供了一个样式来覆盖。奇怪,因为它们在其他页面上工作。

<style type='text/css'>
ui-icon ui-icon-circle-triangle-e {z-index:9999 !important; position:absolute} 
</style>

回答by greg

If you go to Chrome or FF and use the inspector it will tell you which image needs to be there. The element looks like this

如果您转到 Chrome 或 FF 并使用检查器,它会告诉您需要在那里显示哪个图像。元素看起来像这样

<span class="ui-icon ui-icon-circle-triangle-w">

    Prev

</span>

the CSS rule looks something like this

CSS 规则看起来像这样

   background-image: url("images/ui-icons_d8e7f3_256x240.png");
}

As mentioned, the network tab is a great place to see which images are not being loaded.

如前所述,网络选项卡是查看哪些图像未加载的好地方。

The one gotcha here is that the url is relative to the js file. Click on one of the 404 images and you will not the requesting url at the top. Note that the url is relative to the JS file, so if you have an images folder off the root, putting the images there wont help you so much. copy the images folder from the zip you downloaded and place it in the js folder. this resolved the problem for me.

这里的一个问题是 url 是相对于 js 文件的。单击 404 图像之一,您将不会看到顶部的请求 url。请注意,该 url 是相对于 JS 文件的,因此如果您在根目录下有一个图像文件夹,则将图像放在那里不会对您有太大帮助。从您下载的 zip 中复制图像文件夹并将其放在 js 文件夹中。这为我解决了问题。

I read the doc for ChangeMonth as doing something different. I dont think that will solve the problem stated here. http://api.jqueryui.com/datepicker/#option-changeMonth

我阅读了 ChangeMonth 的文档,因为它做了一些不同的事情。我认为这不会解决这里提到的问题。 http://api.jqueryui.com/datepicker/#option-changeMonth