Hi Diego,
the onmouseover is activated as you said but only if the body is present.
Since the doScroll trick works over an interval, I am partially sure that
onmouseover will be fired alwasy before that interval.
document.documentElement.attachEvent("onmouseover", function(){
if(!arguments.callee.fired)
arguments.callee.fired =
!document.documentElement.detachEvent("onmouseover", arguments.callee);
try{
document.documentElement.doScroll("left")
}catch(e){
setTimeout(arguments.callee, 10);
return
};
alert("DOMCOntentLoaded");
});
above example plus an onload event to be sure that if the user is not
surfing that page what we would like to do is performed, could be an
interesting solution in all those cases where the page download is not
interrupted or flushed because in the best case scenario the doScroll trick
will work without problems during the first try.
Maybe superflous, this is just an input :-)
On Sat, Feb 28, 2009 at 2:16 AM, Diego Perini <[email protected]>wrote:
>
> Andrea,
>
> On 28 Feb, 00:42, Andrea Giammarchi <[email protected]>
> wrote:
> > I bet is the classic banner, spot, or JS effect to attach to the mouse
> and
> > somebody asked him why it is not attached since the beginning ... well,
> > Marcus, if it is the case tell them that the browser is inside a window
> and
> > if the user is not interacting with that window there's nothing you can
> do
> > via web except create a plugin to download, even more disturbing ;-)
>
> This is correct...however you can still createEvent() / dispatchEvent
> () whatever type you like but the coordinates must be specified in the
> event initialization method so the scope of the OP is lost again.
>
> The difference in IE and probably a possible reason for this is that
> IE has a global window event for each document so whenever you can get
> at the event object those XY properties have already been populated by
> the underlying layers.
>
> In IE you can ".click()" any element in a programmatic way since all
> have a ".click()" method. The generated event will have current cursor
> position properties up to date and so will other events like
> "onmouseover" you told.
>
> This will not happen in other browsers. And even if it is possible to
> add a ".click()" prototype to elements using browsers native event
> constructor/dispatcher the screenX/screenY should always be passed as
> parameters to the initMoseEvent/initEvent methods.
>
> Take this with a bit of salt...
>
> >
> > In every other case, I am curios as well .... but thanks to this issue I
> > discovered that onmouseover in internet explorer isfired ONLY if the
> > document.body is already present in the DOM, somwthing that could be
> useful
> > for the doScroll interception as well (since Diego is reading this post)
> >
>
> Yes, this is a nice bit of info you got into. You are welcome to set
> something up and explore that approach in your spare time. That will
> just say the "body" was present and the time somebody "mouseover"ed
> it. Far from a "ready" notification but still usable to some extent.
>
> I would like to spare you this, but I know/understand how strong the
> temptation may be and I don't know if a simple sentence like "you are
> talking about Activation events" will convince you desist. There are
> some accidental similarities with the "ready" moment, nothing else.
>
> I went that way with the "onfocus" once trying to achieve cross-
> browser when no DOMContentLoaded existed yet...then I was attracted by
> the "onactivate/onbeforeactivate" trying to solve the exact same
> problem, but I was wrong again that stuff was very useful for another
> task with events... while doScroll() survived to all of IE6/7/8...(to
> date).
>
> All those "Activation" events should be definitely be taken in
> consideration to widen support on IE emulating other browser
> established behaviors (W3C). Hey...I am speaking about IE8 here not
> just about IE6 and IE7.
>
>
> Diego
>
>
> > On Fri, Feb 27, 2009 at 11:13 PM, d3r1v3d (Gavin Mulligan) <
> >
> > [email protected]> wrote:
> >
> > > Just out of curiosity, Marcus, I would be interested to know why you
> > > want to know the user's mouse position before they move it. Maybe
> > > there's a better solution that'll fit snugly within the scope of your
> > > requirements.
> >
> > > - Gavin
> >
> > > On Feb 27, 12:02 pm, unwiredbrain <[email protected]> wrote:
> > > > 2009/2/27 d3r1v3d (Gavin Mulligan) <[email protected]>:
> >
> > > > > You're right, it does seem to work in IE 7. However, it still fails
> to
> > > > > work in Firefox and Chrome...
> >
> > > > Both methods suggested by Andrea Giammarchi are working properly on
> my
> > > > box -- Firefox 3.0.6, Linux.
> >
> > > > I wonder if it's just a Windows' window focus management issue...
> > > > Mac OS X testing anyone?
> >
> > > > Hope that helps
> > > > --
> > > > unwiredbrain
> > > > Linux user #437712
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" 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/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---