【问题标题】:javascript fire cntrl plus + and cntrl + -(minus) event onf button clickjavascript 在按钮单击时触发 ctrl plus + 和 ctrl + -(minus) 事件
【发布时间】:2014-02-20 09:04:21
【问题描述】:

我想创建一个按钮,该按钮在单击时触发事件 cntr plus + 事件以缩放 Web 浏览器窗口,实际上我正在尝试在按钮单击时缩放整个页面。

function fullPagePlus()
{
 $(window).width($(window).width()+100)
}

我厌倦了这段代码,但这不起作用我想在单击单个按钮时触发快捷键有什么办法吗?我也试过这段代码,但它在 mozilla firefox 上不起作用

document.body.style.zoom="300%"

【问题讨论】:

    标签: javascript zooming keyboard-shortcuts


    【解决方案1】:

    如果这是您想要的,请尝试以下代码并更新我们。请参考Demo here

    Firefox 不支持缩放功能。可以看到here,代码如下。

    window.max = function () {
        document.body.style.webkitTransform =
            document.body.style.msTransform =
            document.body.style.transform = 'scale(' + 3 + ')';
        document.body.style.width = 100 / size + '%';
    }
    

    使用变换代替缩放,因为 Mozilla 不支持缩放。

    快乐编码

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多