当幻灯片中的两个按钮(右/左)到达各自的边界时,我需要帮助来禁用它们 -小提琴;将背景颜色和光标类型更改为默认值就足够了。这是 jQuery 代码:
var menuItem_place = 0;
var menuItem_position = 0;
var menuItem_limit = parseInt($('.menuItem').length) - 1;
$('.menuItem:first .content').css({margin: 0, height: '100%', lineHeight: '99px'})
$('#rightBtn').on('click', function(){
if (menuItem_place < menuItem_limit) {
menuItem_place++;
}
menu_animate();
});
$('#leftBtn').on('click', function(){
if (menuItem_place > 0){
menuItem_place--;
}
menu_animate();
});
var menuitems = $('.menuItem');
var contents = $('.content', menuitems);
menuitems.click(function(){
menuItem_place = $(this).index();
menu_animate()
});
function menu_animate() {
contents.animate({margin: 20, height: '64%', lineHeight: '63px'}, 300);
$(contents.get(menuItem_place)).stop().animate({margin: 0, height: '100%', lineHeight: '99px'}, 100)
menuItem_position = 0 - (menuItem_place * 200);
$('#menuContainer').stop().animate({left: menuItem_position + 'px'}, 300);
}
代码不是我的,超出了我的能力范围。任何帮助,将不胜感激。谢谢。
佩德罗