/*+++++hj_go_32+++++*/ /*+++++hj_end_32+++++*/ /*+++++hj_go_33+++++*/ /*+++++hj_end_33+++++*/ /*+++++hj_go_52+++++*/ $(document).ready(function() { var totalImages = $('.hj_mk_52_image-list li').length; // 点击图文列表中的图片,显示放大视图并显示序号和信息 $('.hj_mk_52_image-list li img').click(function() { var src = $(this).attr('src'); var description = $(this).siblings('p').text(); var number = $(this).siblings('.hj_mk_52_image-number').text(); $('.hj_mk_52_enlarged-view img').attr('src', src); $('.hj_mk_52_enlarged-view .hj_mk_52_description').text(description); $('.hj_mk_52_enlarged-view .hj_mk_52_enlarged-number').text(number).css({ 'position': 'absolute', 'bottom': '10px', 'left': '10px' }); $('.hj_mk_52_enlarged-view .hj_mk_52_image-info').text('第 ' + number + ' 张,共 ' + totalImages + ' 张'); $('.hj_mk_52_tck-box').show(); }); // 点击相册中的图片,显示放大视图并显示序号和信息 $('.hj_mk_52_album-images li img').click(function() { var src = $(this).attr('src'); var description = $('.hj_mk_52_image-list li img[src="' + src + '"]').siblings('p').text(); var number = $(this).siblings('.hj_mk_52_image-number').text(); $('.hj_mk_52_enlarged-view img').attr('src', src); $('.hj_mk_52_enlarged-view .hj_mk_52_description').text(description); $('.hj_mk_52_enlarged-view .hj_mk_52_enlarged-number').text(number).css({ 'position': 'absolute', 'bottom': '10px', 'left': '10px' }); $('.hj_mk_52_enlarged-view .hj_mk_52_image-info').text('第 ' + number + ' 张,共 ' + totalImages + ' 张'); $('.hj_mk_52_enlarged-view').show(); }); // 点击左箭头,循环显示上一张图片并更新序号和信息 $('.hj_mk_52_prev-button').click(function() { var currentImage = $('.hj_mk_52_enlarged-view img').attr('src'); var images = $('.hj_mk_52_image-list li img'); var currentIndex = $.inArray(currentImage, $.map(images, function(img) { return $(img).attr('src'); })); if (currentIndex > 0) { var prevImage = images.eq(currentIndex - 1).attr('src'); var prevDescription = images.eq(currentIndex - 1).siblings('p').text(); var prevNumber = images.eq(currentIndex - 1).siblings('.hj_mk_52_image-number').text(); $('.hj_mk_52_enlarged-view img').attr('src', prevImage); $('.hj_mk_52_enlarged-view .hj_mk_52_description').text(prevDescription); $('.hj_mk_52_enlarged-view .hj_mk_52_enlarged-number').text(prevNumber).css({ 'position': 'absolute', 'bottom': '10px', 'left': '10px' }); $('.hj_mk_52_enlarged-view .hj_mk_52_image-info').text('第 ' + prevNumber + ' 张,共 ' + totalImages + ' 张'); } else { var lastImage = images.last().attr('src'); var lastDescription = images.last().siblings('p').text(); var lastNumber = images.last().siblings('.hj_mk_52_image-number').text(); $('.hj_mk_52_enlarged-view img').attr('src', lastImage); $('.hj_mk_52_enlarged-view .hj_mk_52_description').text(lastDescription); $('.hj_mk_52_enlarged-view .hj_mk_52_enlarged-number').text(lastNumber).css({ 'position': 'absolute', 'bottom': '10px', 'left': '10px' }); $('.hj_mk_52_enlarged-view .hj_mk_52_image-info').text('第 ' + lastNumber + ' 张,共 ' + totalImages + ' 张'); } }); // 点击右箭头,循环显示下一张图片并更新序号和信息 $('.hj_mk_52_next-button').click(function() { var currentImage = $('.hj_mk_52_enlarged-view img').attr('src'); var images = $('.hj_mk_52_image-list li img'); var currentIndex = $.inArray(currentImage, $.map(images, function(img) { return $(img).attr('src'); })); console.log(currentIndex); if (currentIndex < images.length - 1) { var nextImage = images.eq(currentIndex + 1).attr('src'); var nextDescription = images.eq(currentIndex + 1).siblings('p').text(); var nextNumber = images.eq(currentIndex + 1).siblings('.hj_mk_52_image-number').text(); $('.hj_mk_52_enlarged-view img').attr('src', nextImage); $('.hj_mk_52_enlarged-view .hj_mk_52_description').text(nextDescription); $('.hj_mk_52_enlarged-view .hj_mk_52_enlarged-number').text(nextNumber).css({ 'position': 'absolute', 'bottom': '10px', 'left': '10px' }); $('.hj_mk_52_enlarged-view .hj_mk_52_image-info').text('第 ' + nextNumber + ' 张,共 ' + totalImages + ' 张'); } else { var firstImage = images.first().attr('src'); var firstDescription = images.first().siblings('p').text(); var firstNumber = images.first().siblings('.hj_mk_52_image-number').text(); $('.hj_mk_52_enlarged-view img').attr('src', firstImage); $('.hj_mk_52_enlarged-view .hj_mk_52_description').text(firstDescription); $('.hj_mk_52_enlarged-view .ehj_mk_52_nlarged-number').text(firstNumber).css({ 'position': 'absolute', 'bottom': '10px', 'left': '10px' }); $('.hj_mk_52_enlarged-view .hj_mk_52_image-info').text('第 ' + firstNumber + ' 张,共 ' + totalImages + ' 张'); } }); // 点击放大视图外部,隐藏放大视图 $('.hj_mk_52_tck-box').click(function(event) { if ($(event.target).is('.hj_mk_52_tck-box')) { $(this).hide(); } }); $('.hj_mk_52_close').click(function(event) { $('.hj_mk_52_tck-box').hide(); }); }); /*+++++hj_end_52+++++*/ /*+++++hj_go_54+++++*/ /*+++++hj_end_54+++++*/