Jquery 触摸屏设备的强制悬停操作

Jquery 触摸屏设备的强制悬停操作,jquery,mobile,touch,Jquery,Mobile,Touch,我正在为我的网站使用。我的网站针对移动设备进行了优化。问题是,幻灯片上的“上一步”和“下一步”按钮只有在您将鼠标悬停在它们上方时才会显示……现在在触摸屏设备上,这是一个问题。如何通过悬停动作强制显示下一个和上一个按钮 下面是控制悬停操作的代码,但不知道这是否必要。我相信它可以在启动前端代码中定义: $(function() { $('#gallery a').lightBox(); }); /*the initiating code*/ jquery lightbox js文件

我正在为我的网站使用。我的网站针对移动设备进行了优化。问题是,幻灯片上的“上一步”和“下一步”按钮只有在您将鼠标悬停在它们上方时才会显示……现在在触摸屏设备上,这是一个问题。如何通过悬停动作强制显示下一个和上一个按钮

下面是控制悬停操作的代码,但不知道这是否必要。我相信它可以在启动前端代码中定义:

$(function() {
        $('#gallery a').lightBox();
}); /*the initiating code*/
jquery lightbox js文件悬停效果代码

function _set_navigation() {
            $('#lightbox-nav').show();

            // Instead to define this configuration in CSS file, we define here. And it´s need to IE. Just.
            $('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' });

            // Show the prev button, if not the first image in set
            if ( settings.activeImage != 0 ) {
                if ( settings.fixedNavigation ) {
                    $('#lightbox-nav-btnPrev').css({ 'background' : 'url(' + settings.imageBtnPrev + ') left 15% no-repeat' })
                        .unbind()
                        .bind('click',function() {
                            settings.activeImage = settings.activeImage - 1;
                            _set_image_to_view();
                            return false;
                        });
                } else {
                    // Show the images button for Next buttons
                    $('#lightbox-nav-btnPrev').unbind().hover(function() {
                        $(this).css({ 'background' : 'url(' + settings.imageBtnPrev + ') left 15% no-repeat' });
                    },function() {
                        $(this).css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' });
                    }).show().bind('click',function() {
                        settings.activeImage = settings.activeImage - 1;
                        _set_image_to_view();
                        return false;
                    });
                }
            }

            // Show the next button, if not the last image in set
            if ( settings.activeImage != ( settings.imageArray.length -1 ) ) {
                if ( settings.fixedNavigation ) {
                    $('#lightbox-nav-btnNext').css({ 'background' : 'url(' + settings.imageBtnNext + ') right 15% no-repeat' })
                        .unbind()
                        .bind('click',function() {
                            settings.activeImage = settings.activeImage + 1;
                            _set_image_to_view();
                            return false;
                        });
                } else {
                    // Show the images button for Next buttons
                    $('#lightbox-nav-btnNext').unbind().hover(function() {
                        $(this).css({ 'background' : 'url(' + settings.imageBtnNext + ') right 15% no-repeat' });
                    },function() {
                        $(this).css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' });
                    }).show().bind('click',function() {
                        settings.activeImage = settings.activeImage + 1;
                        _set_image_to_view();
                        return false;
                    });
                }
            }
            // Enable keyboard navigation
            _enable_keyboard_navigation();
        }

只需将选项
fixedNavigation:true
添加到初始化代码中,这将使“下一步”和“上一步”按钮始终可用

$('#gallery a').lightBox({fixedNavigation:true});

没办法,这么简单…真不敢相信…我没捡到。非常感谢你!