jQuery - 如何获取浏览器窗口滚动水平div时点击? [英] jQuery - How to get browser window to scroll horizontal when div is clicked?

查看:128
本文介绍了jQuery - 如何获取浏览器窗口滚动水平div时点击?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个箭头的图片在div。这个div固定在非常宽的页面的右下角。

I have picture of an arrow in a div. This div is fixed in the bottom right corner of very wide page.

如何在每次点击div时使用jQuery将窗口向右滚动600px? (可以检测页面何时不能向右滚动,并隐藏箭头?)

How can I use jQuery to scroll the window right 600px each time the div is clicked? (And is it possible to detect when the page can no longer scroll right, and hide the arrow?)

干杯。

推荐答案

使用jquery方法scrollLeft

Use the jquery method scrollLeft

$(document).ready(function(){
    $(window).scrollLeft((Number($(window).scrollLeft())+600)+'px');
});

像这样:)

这篇关于jQuery - 如何获取浏览器窗口滚动水平div时点击?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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