我正在移动网站上创建照片滑块。它具有用于向左和向右滚动的按钮。我的Jquery代码可以向右滚动,但不能向左滚动。
似乎在mobilePropertyPictureSlideLeft(mobileSlideArrow)
中出现了问题,特别是在同时返回if
且被视为0
的{{1}}条件下。
我尝试使用false
,但是特定功能永远无法使用。
prevAll().first()
function mobilePropertyPictureSlideRight(mobileSlideArrow) {
var activeMobileSlidePaginationCirle = $(mobileSlideArrow).next('.mobile_property_display_picture_pagination').children('.mobile_property_display_picture_pagination_circle.active_mobile_property_display_picture_pagination_circle');
if ($(activeMobileSlidePaginationCirle).next('.mobile_property_display_picture_pagination_circle').length) {
$(activeMobileSlidePaginationCirle).removeClass('active_mobile_property_display_picture_pagination_circle');
$(activeMobileSlidePaginationCirle).next('.mobile_property_display_picture_pagination_circle').addClass('active_mobile_property_display_picture_pagination_circle');
}
var activeMobileDisplayPicture = $(mobileSlideArrow).prev('.mobile_property_display_picture_container').children('.mobile_property_display_picture.mobile_property_display_picture_in_view');
var mobilePropertyDisplayPictureContainer = $(mobileSlideArrow).prev('.mobile_property_display_picture_container');
if ($(activeMobileDisplayPicture).next('.mobile_property_display_picture').length) {
$(activeMobileDisplayPicture).removeClass('mobile_property_display_picture_in_view');
$(activeMobileDisplayPicture).next('.mobile_property_display_picture').addClass('mobile_property_display_picture_in_view');
$(mobilePropertyDisplayPictureContainer).animate({
scrollLeft: $(mobilePropertyDisplayPictureContainer).scrollLeft() + $(activeMobileDisplayPicture).outerWidth()
}, 400);
}
}
function mobilePropertyPictureSlideLeft(mobileSlideArrow) {
var activeMobileSlidePaginationCirle = $(mobileSlideArrow).next('.mobile_property_display_picture_pagination').children('.mobile_property_display_picture_pagination_circle.active_mobile_property_display_picture_pagination_circle');
if ($(activeMobileSlidePaginationCirle).prev('.mobile_property_display_picture_pagination_circle').length) {
$(activeMobileSlidePaginationCirle).removeClass('active_mobile_property_display_picture_pagination_circle');
$(activeMobileSlidePaginationCirle).prev('.mobile_property_display_picture_pagination_circle').addClass('active_mobile_property_display_picture_pagination_circle');
}
var activeMobileDisplayPicture = $(mobileSlideArrow).prev('.mobile_property_display_picture_container').children('.mobile_property_display_picture.mobile_property_display_picture_in_view');
var mobilePropertyDisplayPictureContainer = $(mobileSlideArrow).prev('.mobile_property_display_picture_container');
if ($(activeMobileDisplayPicture).prev('.mobile_property_display_picture').length) {
$(activeMobileDisplayPicture).removeClass('mobile_property_display_picture_in_view');
$(activeMobileDisplayPicture).prev('.mobile_property_display_picture').addClass('mobile_property_display_picture_in_view');
$(mobilePropertyDisplayPictureContainer).animate({
scrollLeft: $(mobilePropertyDisplayPictureContainer).scrollLeft() - $(activeMobileDisplayPicture).outerWidth()
}, 400);
}
}