我正在开发Tizen TV Web应用程序,并且正在使用Caph(jQuery)进行导航或聚焦。
当我启动应用程序时,导航工作正常,但是当我移至另一个屏幕并返回该屏幕时,焦点无法正常工作。
我不知道为什么卡普不能在上述条件下工作。
代码段如下:
var html = "";
html += '<div class="header" focusable data-focusable-depth="-1" data-focusable-next-focus-up="null" data-focusable-next-focus-right="null" data-focusable-next-focus-left="null" data-focusable-next-focus-down="firstslide" data-focusable-name="menu">'+
'<div class="menu_box"><img src="../images/menu_img.png"></div>'+
'</div>';
//start
html += '<div class="slider_panel">';
for (i=0; i<5; i++)
{
var focus = "", rightFocus = "";
if (i == 0) focus = "data-focusable-initial-focus='true' data-focusable-name='firstslide' data-focusable-next-focus-left='null'";
if (i == (5 - 1)) rightFocus = "data-focusable-next-focus-right='null'";
html += '<div class="slider_box" focusable data-focusable-depth="-1" data-focusable-next-focus-up="menu" data-focusable-next-focus-down="firstslide1" '+ focus +' '+ rightFocus +'>'+
'<div class="slider_header">Slider Heading</div>'+
'<div class="slider_img_box">'+
'<div class="slider_border">'+
'<div class="slider_img">'+
'<img src="" class="slider_thumbnail" onerror="image_error(this);">'+
'</div>'+
'</div>'+
'<div class="slider_shadow"><div class="slider_text">Video Title</div></div>'+
'</div>'+
'</div>';
}
html += '</div>';
// End
// Start
html += '<div class="subtitle_panel">'+
'<div class="main_subtitle">Slide Heading</div>'+
'<div class="subtitle_innerbox">';
for (j=0; j<5; j++)
{
var tFocus = "", tRightFocus ="";
if (j == 0) tFocus = "data-focusable-name='firstslide1' data-focusable-next-focus-left='null'";
if (j == (5 - 1)) tRightFocus = "data-focusable-next-focus-right='null'";
html += '<div class="subtitle_list" focusable data-focusable-depth="-1" data-focusable-next-focus-up="firstslide" data-focusable-next-focus-down="null" '+ tFocus +' '+ tRightFocus +'>'+
'<div class="subtitle_box">'+
'<div class="subtitle_text">This is test data</div>'+
'</div>'+
'</div>';
}
html += '</div>';
html += '</div>';
// end
$(".main_html").html(html);
$.caph.focus.activate();
var controllerProvider = $.caph.focus.controllerProvider.getInstance();
controllerProvider.setDepth(-1);
controllerProvider.focus(controllerProvider.$$getInitialFocusItem());
请帮助我解决此问题。