关闭 jQuery Prettyphoto 上的键盘导航
我们正在使用 PrettyPhoto:
http://www.no -margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/ 对于我们的投资组合。这使我们能够显示视频、图像或 SWF。 当我们显示使用箭头键的 SWF 游戏时,它与 PrettyPhoto 导航发生冲突。 请参阅我们添加的游戏示例:
http://www.letsdesign.co。 uk/#!prettyPhoto/0/ 这在 PC 上的 IE 中会变得更糟。 不过,该游戏可以在 Mac 版 Firefox 上玩,这是我们希望所有浏览器都能达到的状态。
我们希望找到一种方法来关闭 PrettyPhoto 的导航(通过使用箭头键),这样它就不会与任何游戏内控件发生冲突。我们还有其他游戏要添加,但在解决此问题之前我们无法添加它们。有人有解决办法吗? 提前致谢。
We are using prettyPhoto:
http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/
For our portfolio. This allows us to show a video, image or SWF.
When we display a SWF game that uses the arrow keys, it conflicts with prettyPhoto navigation.
See this example of a game we have added:
http://www.letsdesign.co.uk/#!prettyPhoto/0/
This messes up worse in IE on PC.
however the game is playable on Firefox for Mac, this is the state we would like for all browsers.
We would like to find a way to turn off the navigation of PrettyPhoto (by using arrow keys), so it doesn't conflict with any in-game controls. We have other games to add, but we can't add them until this is fixed. Does anyone have a solution to this?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在 Prettyphoto 的 JavaScript 文件中将 keyboard_shortcuts 设置为 false
In the JavaScript file of Prettyphoto set the keyboard_shortcuts to false
我发现了一种非常古怪的方法来禁用箭头键功能。在我的 jquery.prettyPhoto.js 文件中,我刚刚注释掉了
$.prettyPhoto.changePage('previous');
和$.prettyPhoto.changePage('next');
。这意味着箭头导航根本不起作用,但我的项目无论如何都不需要它。
I found a really hacky way to disable the arrow key functionality. In my jquery.prettyPhoto.js file I just commented out
$.prettyPhoto.changePage('previous');
and$.prettyPhoto.changePage('next');
.It will mean that arrow navigation doesn't work at all, but I don't need it for my project anyway.
不幸的是,有一个错误。我修改了代码,现在效果很好。
这是错误。有一段代码是这样的:
通过以下代码更改它
现在作者的设置,称为keyboard_shortcuts,如果将其设置为false,将会很好地工作。
这对于缩小代码有效,我没有检查非缩小代码中是否存在错误(如果有)。
祝你好运!
乔治
There's a bug, unfortunately. I have modified the code and now it works great.
Here's the bug. There is a piece of code like this:
change this by the following one
Now the author's setting, called keyboard_shortcuts will work great if you set it to false.
This is valid for the minified code, I haven't check if the bug exists in the non-minified code (if available).
Good luck!
George
在尝试通过将“keyboard_shortcuts”参数设置为 false 来禁用包括(左和右)在内的键盘快捷键后,我求助于覆盖changePage方法并从changepicturecallback方法调用该方法。我发现这样可以轻松选择 PrettyPhoto 的不同体验,而无需编辑核心文件(我永远不会推荐)。
看看 PrettyPhoto 参数,正确组合它们会非常强大。
After trying to disable keyboard shortcuts including (left and right) by setting the "keyboard_shortcuts" param to false I resorted to overriding the changePage method and called the method from the changepicturecallback method. I find this makes it easy to choose different experiences of prettyPhoto without having to edit core files (which I would never recommend).
Take a look at the prettyPhoto params they are very powerful when combined properly.