>>My app have a list that as you scroll if it "hits" a dummy div or a static
position
>>on the viewport I want it to get highlighted in some way.
>>Google reader is an excelent example
>>however on this scenario I don't really have an even't to track just the
page scroll.
In that case, instead of trying to use the "onmouse*" events, it sounds like
you want to use the onscroll event.  I don't *think* that this event is a
standard JS event, but even so it is supported by pretty much every browser
you could care about (see http://www.quirksmode.org/js/events_compinfo.html
).

Basically you'll want to do something like:
connect(window, "onload", function() {
    connect(window, "onscroll", function() {
        // Use Mochikit's style library functions (like getViewportPosition)
here to determine whether you have a "collision"
        // If you do have a collision, trigger whatever highlighting
function you want
}
}

Hope that helps.

Jeremy

On Thu, Apr 24, 2008 at 12:55 PM, Matías Iturburu <[EMAIL PROTECTED]>
wrote:

>
>
> On Thu, Apr 24, 2008 at 4:05 PM, machineghost <[EMAIL PROTECTED]>
> wrote:
>
>>
>> Could you be a little more specific as to what you mean by "collision
>> detection": what exactly is colliding that you want to detect?
>
>
> Ok, I'll try:
>   My app have a list that as you scroll if it "hits" a dummy div or a
> static position on the viewport I want it to get highlighted in some way.
>   Google reader is an excelent example
>
>
>>
>>
>> If you just want to detect when the mouse enters and leaves certain
>> areas, all you need to do is define those areas somehow with HTML
>> elements (if these areas are completely abstract, I'd give BODY some
>> DIV children with a high z-index, absolute positioning, and no
>> content, and then use left/top/width/height to describe each area's
>> dimensions/position; if however you already have some existing
>> elements that describe the areas, just use them).  Then, use Signal's
>> connect function to hookup some onmouseenter/onmouseleave events to
>> your HTML elements, and ... you're done.  Whenever the mouse cursor
>> "collides" with one of your areas, the function you connected will go
>> off.
>
>
> Interesting, however on this scenario I don't really have an even't to
> track just the page scroll. Hope that helps.
>
> Thanks for the quick response
>
>
>
>>
>> Jeremy
>>
>> On Apr 24, 6:54 am, Matías Iturburu <[EMAIL PROTECTED]> wrote:
>> > Hi all, this is my first post on the list.
>> >
>> > I'm looking for some clean way of doing collision detection on a
>> > project that uses mochikit.
>> > I spent some time looking for algorithms and the like and get to make
>> > a little demo using plain old javascript, and just started to try to
>> > make it work with mochi and the style module (getElementPosition
>> > rocks) but I was wondering if mochikit provides facilities to make it
>> > cleaner.
>> >
>> > So, you have any pointer? anyone has done stuff like this with/inside
>> > mochikit?
>> >
>> > Regards
>> >
>> > Matías
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to