Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #28468

Re: Move a div with mouse

From "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it>
Newsgroups comp.lang.javascript
Subject Re: Move a div with mouse
Date 2015-07-25 19:47 +0200
Organization A noiseless patient Spider
Message-ID <mp0i2h$aq4$1@dont-email.me> (permalink)
References <mola7b$fmu$1@dont-email.me> <24793803.Cl0v73UULg@PointedEars.de> <mou5ap$180$1@dont-email.me> <13075758.S88mDJZToQ@PointedEars.de>

Show all headers | View raw


Il 07/25/2015 02:07 PM, Thomas 'PointedEars' Lahn ha scritto:
> danca (Daniele Campagna) wrote:
>
>> Il 07/24/2015 08:36 PM, Thomas 'PointedEars' Lahn ha scritto:
>>> danca (Daniele Campagna) wrote:
>>
>> […]
>> I TRIED to copy-and-paste and then to adjust the [horrible] result.
>
> I think you know what to do now.
>

Apart from putting comments between /*..*/ I am not sure about the 72 
columns limit - I often read messages not wrapped at all, and I must 
explicitly word wrap them (CTRL-R in Thunderbird). But no clues about 
the messages I write.

>> So it is not correct to infer[It exists? I mean make a deduction] that
>> if document.addEventListener does not exist <something>.addEventListener
>> couldn't instead exist?
>
> Yes.
>
>> Hummmmm...
>> (Ubi major minus cessat).
>
> _maior_

And minor, not minus. I need vacations.

>
>>>> […]
>>>>      }else{ alert("no event")// just in case}
>>>
>>> This may be a syntax error.  Your code is so unreadable that it is
>>> difficult to tell without copying and reformatting it.
>>>
>>>>      document.onmouseup = function() {
>>>>       document.onmousemove = null;
>>>>       document.onmouseup = null;
>>>>      }
>>>
>>> Nonsense.
>>
>> Ehm... it should cancel the event listeners - and it seems to work in IE
>> and FF. What's wrong with canceling eventListeners that simple way?
>
> *Events* are canceled, not event listeners.

OK

>
> You are defining and _undefining_ event listeners here.  It makes no sense
> to define/*overwrite* an event listener for an event, that may not have been
> defined in the first place, just to undefine it when the event is fired.
>

The onmousedown activates the onmousemove and the onmouseup. The latter 
in turn when fired cancels the onmousemove and itself - so it is fired 
only one time and only if it has been defined by onmousedown.

Dan
-- 
"Everybody should pay taxes with a smile"
I tried, but they want money.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Move a div with mouse "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-21 13:26 +0200
  Re: Move a div with mouse Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-24 20:36 +0200
    Re: Move a div with mouse "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-24 21:58 +0200
      Re: Move a div with mouse Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-25 14:07 +0200
        Re: Move a div with mouse "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-25 19:47 +0200
          Re: Move a div with mouse Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-25 20:54 +0200
            Re: Move a div with mouse "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-26 12:54 +0200
              Re: Move a div with mouse Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-26 13:36 +0200

csiph-web