jquery水平滚动事件 - 编辑 [英] jquery horizontal scroll event - Edit

查看:94
本文介绍了jquery水平滚动事件 - 编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有一个水平滚动的图库,我想添加动态标题,页面上的标题是静态的,我希望它们在用户滚动浏览每个图像时打开和关闭。

b
$ b

继承人页面模拟:

http://www.jonathantopf.com/imijstudio/



为了证明我的概念,上面的画廊,我想用它来触发事件,当它进入屏幕。任何想法?



我使用航点,但无法弄清楚如何设置它来侦听水平滚动事件。我对jquery非常陌生,因为您可能会知道,所以任何帮助都是非常感激的,



继承人我到目前为止所尝试的:

  $(document).ready(function(){

$(#blob)。
alert('waypoint reached。');
});


});

以下是错误:

<$ p $没有捕获的TypeError:对象函数(选择器,上下文){
// jQuery对象实际上只是init构造函数的'enhanced'
return new jQuery.fn.init(selector ,上下文);
}没有方法'isWindow'

更新:升级到最新版本的jquery,似乎解决了consloe错误。它现在可以工作,但只有当广场垂直进入框架时,我才能找到如何将方向设置为水平。



谢谢


解决方案

嘿,你只需要使用$(window).scroll和scrollleft的值我在这里为你做了一个简单的测试:

http:// jsfiddle.net/vJUXy/



让我知道如果我误解了吗?
Alex


Hi there I have a horizontally scrolling gallery that i want to add dynamic captions to, the captions are static on the page and I would like them to toggle on and off when the user scrolls past each image.

heres a mock up of the page:

http://www.jonathantopf.com/imijstudio/

For a proof of concept i have a little red square in the above gallery that i would like to use to trigger an event when it enters the screen. Any ideas?

I had a go using waypoints but couldn't figure out how to set it to listen for horizontal scroll events. I'm very new to jquery as you might be able to tell so any help is greatly appreciated,

Heres what I tried so far:

$(document).ready(function() {

$("#blob").waypoint(function() {
    alert('waypoint reached.');
});


});

and here's the error:

Uncaught TypeError: Object function ( selector, context ) {
    // The jQuery object is actually just the init constructor 'enhanced'
    return new jQuery.fn.init( selector, context );
} has no method 'isWindow'

UPDATE: upgraded to latest version of jquery, that seemed to fix the consloe error. It works now but only when the square enters the frame vertically, i can t find how to set the orientation to horizontal.

Thanks

jon

解决方案

Hey you just need to use the $(window).scroll and the value from scrollleft ive done a simple test for you here:

http://jsfiddle.net/vJUXy/

let me know if ive misunderstood? Alex

这篇关于jquery水平滚动事件 - 编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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