【问题标题】:Is there a way to set the vertical scroll position of a page when at a specific break point?有没有办法在特定断点处设置页面的垂直滚动位置?
【发布时间】:2018-02-17 14:58:06
【问题描述】:

如果浏览器/设备的宽度被调整到某个断点(480 像素),我希望页面向下滚动到锚点 ID(或向下滚动 1000 像素)。这可能吗?

【问题讨论】:

    标签: javascript css media-queries


    【解决方案1】:

    如果窗口被调整大小,您将需要在$(window).width() 条件中编写滚动代码

    $(window).on("resize", function() {
      if ($(window).width() <= 480) {
        //write your scrolling code here
      }
    })
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-23
      • 1970-01-01
      • 2016-04-28
      • 2016-02-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多