搜索文档时停止浏览器自动滚动(ctrl + f) [英] Stop browser from auto scrolling when searching document (ctrl + f)

查看:312
本文介绍了搜索文档时停止浏览器自动滚动(ctrl + f)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,使用jquery在定义的高度/宽度框中滚动。

这很好,直到您尝试Ctrl + F搜索。然后,它会不定期地移动,在页面之间中途停下来,并在幻灯片之间移动我的幻灯片。

有没有什么办法可以禁用这个功能?

解决方案

你可以这样做,找到不会找到的话!其中一种方法是使用js:
$ b $ pre $ window.addEventListener(keydown,function(e){
if(e.keyCode === 114 ||(e.ctrlKey& e.keyCode === 70)){
e.preventDefault();
} $ b $ (但有一个菜单查找选项;)但可以覆盖默认的浏览器快捷方式,还有一些比有效的时间还要快......只要拿JSfiddle或Google文档为例)

I have a website that uses jquery to scroll around in a defined height/width box.

This works great, until you try to Ctrl + F search. Then, it moves around erratically, stopping halfway between pages, and moving my slideshows between slides. This completely breaks it and needs to be reloaded for the functionality to return.

Is there any way to disable this?

解决方案

you could make it so that Find won't find the words! One way to do this would be to use the js:

 window.addEventListener("keydown",function (e) {
    if (e.keyCode === 114 || (e.ctrlKey && e.keyCode === 70)) { 
        e.preventDefault();
    }
})

(however there is a menu Find option ;) but It is possible to override default browser shortcuts, and there are some more than valid times do it too... just take JSfiddle or Google Docs for example, )

这篇关于搜索文档时停止浏览器自动滚动(ctrl + f)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆