dranoc,
(function($) {
$(function() {
var jcarousel = $(".jcarousel");
jcarousel.on("jcarousel:reload jcarousel:create", function() {
var carousel = $(this),
width = carousel.innerWidth();
if (width >= 600) width = width / 3;
else if (width >= 350) width = width / 2;
carousel.jcarousel("items").css("width", Math.ceil(width) + "px")
}).jcarousel({
wrap: "circular"
}).jcarouselAutoscroll({
interval: 1800,
target: "-=1",
autostart: false
}).mousemove(function(event) {
var prev = event.clientX < jcarousel.innerWidth() / 2;
var data = jcarousel.data("prev");
if (data != prev) {
var target =
prev ? "-=1" : "+=1";
jcarousel.data("prev", prev).jcarousel("scroll", target).jcarouselAutoscroll("reload", {
target: target
}).jcarouselAutoscroll("start")
}
}).mouseleave(function() {
jcarousel.jcarouselAutoscroll("stop")
});
$(".jcarousel-control-prev").jcarouselControl({
target: "-=1"
});
$(".jcarousel-control-next").jcarouselControl({
target: "+=1"
});
$(".jcarousel-pagination").on("jcarouselpagination:active", "a", function() {
$(this).addClass("active")
}).on("jcarouselpagination:inactive", "a", function() {
$(this).removeClass("active")
}).on("click",
function(e) {
e.preventDefault()
}).jcarouselPagination({
perPage: 3,
item: function(page) {
return '<a href="#' + page + '">' + page + "</a>"
}
})
})
})(jQuery);