adding a small feature to jCarousel
I just finished working with jCar开发者_如何学Pythonousel and it works fine, however my client needs to add one more thing. Please check this out: http://sneakyrascal.com/coupon2/ You can see "Σελίδα 1/5" at the top of the content slider which refers to 5 pages and has to be changed with the current page. I haven't found a way to do that, is it possible to add this feature to jCarousel?
Thanks
It's already been solved, for those who want the answer:
$(function(){
$(".jcarousel-next-horizontal").click(function(){
var currentTime = Date.now();
var lastClickTime = $(this).data("lastClickTime");
if (lastClickTime && (currentTime - lastClickTime < 500)) {
return(false); // ignore the click
}
$(this).data("lastClickTime", currentTime); // record time of last click
var currentValue = $(".pages").text();
var five = "5";
var newValue = parseInt(parseFloat(currentValue)) + 1;
$(".pages").text(newValue);
if (currentValue==five) {
$(".pages").text("5");
}
});
$(".jcarousel-prev-horizontal").click(function(){
var currentTime = Date.now();
var lastClickTime = $(this).data("lastClickTime");
if (lastClickTime && (currentTime - lastClickTime < 500)) {
return(false); // ignore the click
}
$(this).data("lastClickTime", currentTime); // record time of last click
var currentValue = $(".pages").text();
var newValue = parseInt(parseFloat(currentValue)) - 1;
var one = "1";
$(".pages").text(newValue);
if (currentValue==one) {
$(".pages").text("1");
}
});
});
精彩评论