diff --git a/www/js/beauty.js b/www/js/beauty.js index ecba848..96f9c8c 100644 --- a/www/js/beauty.js +++ b/www/js/beauty.js @@ -168,6 +168,12 @@ if ($('#image_site').get(0)) { }, endSlideshow: function(fancybox) { refreshFancyBoxStatus = 'off'; + }, + keydown: function(fancybox, eventName) { + console.log(`Fancybox eventName: ${eventName}`); + if (eventName == 'ArrowDown') { + return false; + } } } }); @@ -1001,10 +1007,8 @@ var RC_LEFT = 37; RC_ENTER = 13; //tv only - RC_NEXT_CHANNEL = 10007, //TODO: 待确认 - RC_PRV_CHANNEL = 10008, - RC_BACK = 10009; - RC_EXIT = 10182; + RC_PLAY = 415, + RC_STOP = 413; //support a and button var getNextSibling = function(el, way) { @@ -1038,7 +1042,12 @@ var getNextSibling = function(el, way) { if ($(el).parent('li').length > 0) { next = $(el).parents('ul').prevAll('.nav').find('li').first(); if (next.length == 0) { - next = $(el).parents('ul').prev('.im_mainl').find('.im_item').first(); + //next = $(el).parents('ul').prev('.im_mainl').find('.im_item').first(); + if ($(el).parents('.im_mainl').length > 0) { + next = $(el).parents('ul').first().prevAll('.im_item').first(); + }else { + next = $(el).parents('ul').first().prevAll('.im_mainl').find('.im_item').first(); + } } }else if ($(el).parent('.im_item').length > 0) { next = $(el).parent().prevAll('.im_item'); //6 images in one row @@ -1051,7 +1060,7 @@ var getNextSibling = function(el, way) { if (!next) { next = $(el).parent('.im_item').prevAll('ul').first().find('li').first(); if (next.length == 0) { - next = $(el).parents('.im_mainl').prev('.nav').find('li.active'); + next = $(el).parents('.im_mainl').prevAll('.nav').first().find('li.active'); } } } @@ -1079,8 +1088,8 @@ var getNextSibling = function(el, way) { next = null; } - if (!next && $(el).parents('.im_mainl').next('.nav').length > 0) { - next = $(el).parents('.im_mainl').next('.nav').find('li.active'); + if (!next && $(el).parents('.im_mainl').nextAll('.nav').length > 0) { + next = $(el).parents('.im_mainl').nextAll('.nav').first().find('li.active'); }else if (!next && $('div.pagination-con').length > 0) { next = $('div.pagination-con').find('li.active').next(); } @@ -1137,8 +1146,19 @@ $(document.body).on('keydown', function(e) { keyPress('up'); }else if (e.keyCode == RC_DOWN) { keyPress('down'); - }else if (e.keyCode == RC_ENTER) { + }else if (e.keyCode == RC_PLAY) { //play images - + var fancybox = Fancybox.getInstance(); + if (fancybox) { + var autoplay = fancybox.plugins.Slideshow.ref; + autoplay.start(); + } + }else if (e.keyCode == RC_STOP) { + //stop play images + var fancybox = Fancybox.getInstance(); + if (fancybox) { + var autoplay = fancybox.plugins.Slideshow.ref; + autoplay.stop(); + } } }); \ No newline at end of file