问题实例化 jQuery jCarousel
Issue Instantiating jQuery jCarousel
我在使用 jQuery 1.11.2 为我的新应用程序实例化 jCarousel 时遇到问题。我没有使用 jQuery UI.
这里是Website
我认为调用有问题:
jQuery('#mycarousel').jcarousel({
此 Carousel 运行 在之前使用 jQuery 1.8.2
的应用程序中没有问题
我测试了 Carousel 使用的 RSS Feed,看起来不错:
Blog RSS Feed
这是 运行 之前没有问题的确切代码:
var mycarousel_itemList = new Array();
function mycarousel_itemLoadCallback(carousel, state) {
for (var i = carousel.first; i <= carousel.last; i++) {
if (carousel.has(i)) {
continue;
}
if (i > mycarousel_itemList.length) {
break;
}
carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[i - 1]));
}
};
function mycarousel_getItemHTML(item) {
return '<a href="' + item.url + '">' + item.title + '</a>' + ' ' + item.description.replace(/<\/?[^>]+(>|$)/g, "");
};
jQuery(document).ready(function () {
$.get("http://www.davincispainting.com/blog/syndication.axd", function (data) {
var $xml = $(data);
$xml.find("item").each(function () {
var $this = $(this),
item = {
title: $this.find("title").text(),
link: $this.find("link").text(),
description: $this.find("description").text()
}
mycarousel_itemList.push({
url: item.link,
title: item.title,
description: item.description
});
});
jQuery('#mycarousel').jcarousel({
vertical: true,
scroll: 1,
auto: 1,
wrap: 'circular',
size: mycarousel_itemList.length,
itemLoadCallback: { onBeforeAnimation: mycarousel_itemLoadCallback }
});
});
});
<div class="col-md-4 boxopacity" style="margin-top: -10px;">
<div class="headline">
<h2>Painting Blog & Information</h2>
</div>
<ul id="mycarousel" class="jcarousel-skin-ie7">
</ul>
</div>
如果有人能告诉我我遗漏了什么,那真的很有帮助吗?
谢谢!
你检查过日志了吗?有很多问题(错误),包括无法加载 jquery.jcarousel.min.js 文件。
请问"jcarousel.min.js"文件的路径是否正确?
它向我显示以下错误。
"NetworkError: 404 Not Found - http://www.davincispainting.com/js/jquery.jcarousel.min.js"
如果是这样,请为其创建正确的路径。或者您也可以使用以下路径。请检查这个,如果您仍然遇到同样的问题,请告诉我们。
jquery.jcarousel.js
并在 jquery 文件后再包含一个文件
我在使用 jQuery 1.11.2 为我的新应用程序实例化 jCarousel 时遇到问题。我没有使用 jQuery UI.
这里是Website
我认为调用有问题:
jQuery('#mycarousel').jcarousel({
此 Carousel 运行 在之前使用 jQuery 1.8.2
的应用程序中没有问题我测试了 Carousel 使用的 RSS Feed,看起来不错: Blog RSS Feed
这是 运行 之前没有问题的确切代码:
var mycarousel_itemList = new Array();
function mycarousel_itemLoadCallback(carousel, state) {
for (var i = carousel.first; i <= carousel.last; i++) {
if (carousel.has(i)) {
continue;
}
if (i > mycarousel_itemList.length) {
break;
}
carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[i - 1]));
}
};
function mycarousel_getItemHTML(item) {
return '<a href="' + item.url + '">' + item.title + '</a>' + ' ' + item.description.replace(/<\/?[^>]+(>|$)/g, "");
};
jQuery(document).ready(function () {
$.get("http://www.davincispainting.com/blog/syndication.axd", function (data) {
var $xml = $(data);
$xml.find("item").each(function () {
var $this = $(this),
item = {
title: $this.find("title").text(),
link: $this.find("link").text(),
description: $this.find("description").text()
}
mycarousel_itemList.push({
url: item.link,
title: item.title,
description: item.description
});
});
jQuery('#mycarousel').jcarousel({
vertical: true,
scroll: 1,
auto: 1,
wrap: 'circular',
size: mycarousel_itemList.length,
itemLoadCallback: { onBeforeAnimation: mycarousel_itemLoadCallback }
});
});
});
<div class="col-md-4 boxopacity" style="margin-top: -10px;">
<div class="headline">
<h2>Painting Blog & Information</h2>
</div>
<ul id="mycarousel" class="jcarousel-skin-ie7">
</ul>
</div>
如果有人能告诉我我遗漏了什么,那真的很有帮助吗? 谢谢!
你检查过日志了吗?有很多问题(错误),包括无法加载 jquery.jcarousel.min.js 文件。
请问"jcarousel.min.js"文件的路径是否正确?
它向我显示以下错误。
"NetworkError: 404 Not Found - http://www.davincispainting.com/js/jquery.jcarousel.min.js"
如果是这样,请为其创建正确的路径。或者您也可以使用以下路径。请检查这个,如果您仍然遇到同样的问题,请告诉我们。
jquery.jcarousel.js
并在 jquery 文件后再包含一个文件