469,271 Members | 1,494 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

onhover Emulation

So a client requires a useless column on the page that contains
employee profile blocks with little images in them. The div tag
containing the content has an overflow of hidden. It contains more
profile blocks that can be seen. The task is to have the thing scroll
through the profiles when a user hovers the edge. I have it scrolling
one block at a time 'onclick'. My question is this: Is there a simple,
efficient way to capture a continuous mouse hover? I guess I could
keep checking the mouse position, but that seems too inefficient to be
the best way.

Thanks.
Feb 26 '08 #1
4 2022
exiquio <ex*****@gmail.comwrites:
>My question is this: Is there a simple, efficient way to capture a
continuous mouse hover? I guess I could keep checking the mouse
position, but that seems too inefficient to be the best way.
You can't "keep checking the mouse position". Just use mousemove events.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Feb 26 '08 #2
exiquio <ex*****@gmail.comwrites:
On Feb 25, 7:11*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:

That doesn't seem to work. The initial mouse over causes the event to
trigger, but there is not action to follow. I am using mootools for
this. Here is the code:
[snip]

You want some kind of timeout/interval event to scoll on while the mouse
hasn't move out of the element. I'm not familiar with the library you're
using. You also don't need [code] tags to post code. This is usenet. We
tend to use plain text.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Feb 26 '08 #3
On Feb 25, 7:24*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
exiquio <exiq...@gmail.comwrites:
On Feb 25, 7:11*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
That doesn't seem to work. The initial mouse over causes the event to
trigger, but there is not action to follow. I am using mootools for
this. Here is the code:

*[snip]

You want some kind of timeout/interval event to scoll on while the mouse
hasn't move out of the element. I'm not familiar with the library you're
using. You also don't need [code] tags to post code. This is usenet. We
tend to use plain text.

--
Joost Diepenmaat | blog:http://joost.zeekat.nl/| work:http://zeekat.nl/
Thanks. My bad about the tags.
Feb 26 '08 #4
On Feb 25, 7:27*pm, exiquio <exiq...@gmail.comwrote:
On Feb 25, 7:24*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
exiquio <exiq...@gmail.comwrites:
On Feb 25, 7:11*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
That doesn't seem to work. The initial mouse over causes the event to
trigger, but there is not action to follow. I am using mootools for
this. Here is the code:
*[snip]
You want some kind of timeout/interval event to scoll on while the mouse
hasn't move out of the element. I'm not familiar with the library you're
using. You also don't need [code] tags to post code. This is usenet. We
tend to use plain text.
--
Joost Diepenmaat | blog:http://joost.zeekat.nl/|work:http://zeekat.nl/

Thanks. My bad about the tags.
So here is the working code. I will change the intervals, but that
isn't important. Thanks Joost.

window.addEvent('domready', function(){
// Create a global namespace API
var JD = function(){
/* PRIVATE */
// Create a scrolling object for the team box
var team_scroll = new Fx.Scroll(
'team_side_bar',
{
duration: 1000
}
);
var position = 0;
/* END PRIVATE */

/* PUBLIC */
return{
init: function(){
// Register events for team bar scrolling
var topTriggerTimer = function(){};
var bottomTriggerTimer = function(){};
// TODO (exiquio) adjust pixels
$('top_trigger').addEvent('mouseenter', function(event){
topTriggerTimer = (function(){
team_scroll.scrollTo(0, position - 116);
position = position - 116;
}).periodical(1500);
});
$('top_trigger').addEvent('mouseleave', function(event){
$clear(topTriggerTimer);
});
$('bottom_trigger').addEvent('mouseenter', function(event){
bottomTriggerTimer = (function(){
team_scroll.scrollTo(0, position + 116);
position = position + 116;
}).periodical(1500);
});
$('bottom_trigger').addEvent('mouseleave', function(event){
$clear(bottomTriggerTimer);
});
}
}
/* END PUBLIC */
}();
// Call init()
JD.init();
});
Feb 26 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Chris | last post: by
reply views Thread by Pam Sheldon | last post: by
3 posts views Thread by Gilles Cadorel | last post: by
4 posts views Thread by Gord Murray | last post: by
3 posts views Thread by ShadowMan | last post: by
reply views Thread by Jose Michael Meo R. Barrido | last post: by
reply views Thread by Maddog | last post: by
1 post views Thread by Nathan Young | last post: by
reply views Thread by lysdexia | last post: by
8 posts views Thread by Ethan Furman | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.