473,379 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Using scriptaculous, how to trigger mouseover effect ONLY if mousedover for a period of time

I am using the Scriptaculous/Prototype libraries to build a project
and I really want to have an effect like the mootools download page
(http://www.mootools.net/download) where when you mouse over the lines
at the bottom very fast, the lines do not highlight. They only
highlight if your mouse is over them for slightly longer.

Sadly, I can't use the mootools library, so I am hoping someone can
point me in the right direction.

I am calling a function called Effect.Morph to change the background
of a div area upon mouseover and it looks like this:

elem[j].onmouseover = function(){
new Effect.Morph(this,{style:'background:#989898;
color:#FFF',duration:0.2,delay:0.2});
}
elem[j].onmouseout = function(){
new Effect.Morph(this,{style:'background:#FFF;
color:#989898',duration:0.2,delay:0.2});
}

So, as you can see if a user mouses over, the element's background is
immediately changed to morph to the new background color and text
color and then upon mouse out, revert back. The problem is that this
happens even if you mouse VERY quickly over the areas, so you end up
with a twitchy mess on your hands when they are all on rows, one on
top of the other. But mootools seems to have figured out that if the
mouse doesn't hover for at least a tiny bit, it doesn't run.

If anyone has ideas, that would be fantastic!

Thanks!
Jun 27 '08 #1
2 2616
On Apr 28, 10:14 am, AndrewC <EmergingD...@gmail.comwrote:
I am using the Scriptaculous/Prototype libraries to build a project
and I really want to have an effect like the mootools download page
(http://www.mootools.net/download) where when you mouse over the lines
at the bottom very fast, the lines do not highlight. They only
highlight if your mouse is over them for slightly longer.
A generic solution is to have your mouseover handler call the function
using setTimeout with a delay of say 50ms (or whatever appears to be
right). If a mouseout is received from the same element before the
timer fires, cancel it.

You'll probably end up building a small event manager to keep track of
the timeouts and (perhaps) to deal with bubbling events.
--
Rob
Jun 27 '08 #2
Hello Andrew,

Scriptaculous should be able to do this pretty easily,using the
Effect.Morph:
http://wiki.script.aculo.us/scriptac...w/Effect.Morph

Prototype doesn't have crossbrowser support for the "mouseenter"
"mouseleave" events by default,
so you will have to add that (its only a couple lines)

I have a pastie of the code you need and a mockup of the effect that
the MooTools download page is using.
http://pastie.caboo.se/189315

Also here is the support list for Prototype/Scriptaculous:
http://groups.google.com/group/rubyonrails-spinoffs
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Dave C. | last post by:
Hello, I have created the following trigger: CREATE TRIGGER tr_UDFTest ON UserDefinedFields FOR INSERT, UPDATE AS DECLARE @foobar varchar(100) SELECT @foobar= foobar FROM inserted IF (...
7
by: rkrueger | last post by:
Given the following 3 Tables: CREATE TABLE ( NOT NULL , NOT NULL CONSTRAINT DEFAULT (getdate()), NULL , CONSTRAINT PRIMARY KEY CLUSTERED (
7
by: Serge Rielau | last post by:
Hi all, Following Ian's passionate postings on problems with ALTOBJ and the alter table wizard in the control center I'll try to explain how to use ALTOBJ with this thread. I'm not going to get...
7
by: libsfan01 | last post by:
hi guys is there an extension for scriptaculous (or another library) that allows you to create more organic/natural looking movement? for example when an image slides across the screen, it...
3
by: libsfan01 | last post by:
hi i have a page which contains an visible nav down the left-hand side. when you click a button it needs to appear. i thought it would be cool to use scriptaculous to make it slide down. can...
1
by: trint | last post by:
Hi, I have an Image to become a link (as soon as I figure out whether it should be a button or not) that, when mousedover, changes instantly to another image. I want the image itself to be the...
2
by: newholborn | last post by:
<div id="navigation"> <span onclick="Effect.toggle(this.parentNode.id+'Content','blind')">Navigation</span> <ul id="navigationContent"> <li><a href="#" name="main"...
1
sgeklor
by: sgeklor | last post by:
Dear All, My question refers to how best to organise my mouse events to correctly and efficiently give the effect I want. On my form I have a panel and that panel contains a number of controls....
3
by: apurvaG | last post by:
Hi All, I am applying some xslt template on a XML file to generate the HTML. This HTML has several <DIV> tags with mouseover and mouseout event associated to them. So if i do mouseover on a...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.