Okay.
I basicly want an event like
onElementClose
Basicly will trigger a function when another div/block/element comes within a certain area around it (say 5px for eg).
I am sure custom events are possible, I have seen strange examples around.
So unless you are 100% certain this is impossible, please dont say its impossible.
a setInterval that checks if there is an element around it every so long is not acceptable. as there will be hundreds of elements using this event.
If i havent explained this clearly enough please ask
Thanks, Josh.
11 1706 acoder 16,027
Recognized Expert Moderator MVP
How will the elements come close, i.e. will they be moved from their original position, or will new elements be created which could potentially come close to an already existing element?
moved from their origonal position, the elements will all be position: absolute.
So will be moved by an x and y axis using "left" and "top"
acoder 16,027
Recognized Expert Moderator MVP
If you're YUI or Dojo, they have support for custom events, see, for example, YUI Custom Events. You might find this article useful too.
this looks complicated, thanks guys, ill have a read.
What d you mean by mutation events? also: I would prefer to avoid third party scripts/libraries if possible.
addEventListener <- I dont entirely understand what they mean about this function what exactly does it do? If anyone could help me with any of this, or even better start me off, would be mnuch apreciated.
cheers, Josh
acoder 16,027
Recognized Expert Moderator MVP
What d you mean by mutation events?...
addEventListener <- I dont entirely understand what they mean about this function what exactly does it do?
Mutation events notify of changes to the document structure. However, these are not well supported. Firefox, Safari and Opera support some of them.
addEventListener is a more advanced event model method. Unfortunately, it's not supported by IE (as ever). Fortunately, IE has its own version. See this link for more information.
I read that, but I dont really see the difference between:
element.addEventListener('click',doSomething,false )
element.onclick = doSomething;
I understand eventlistener can be used multiple times, but apart from that are they exactly the same?
cheers Josh
acoder 16,027
Recognized Expert Moderator MVP
wait so if im understanding this correctly.
This wont bubble:
element.addEventListener('click',doSomething,false );
This will buble:
element.onclick = doSomething;
meaning the first one will only activate if it is clicked (and wont activate if its children are clicked, where the second one would)
Thanks again acoder, Josh
acoder 16,027
Recognized Expert Moderator MVP
No, if you have false as the third argument, it will bubble. When it's true, it's in the capturing phase (parent fires first, then child). If you want to stop bubbling/capturing, use stopPropagation() (W3C) and cancelBubble=true (Microsoft). See this link for a good explanation of this concept.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Hawk |
last post by:
I have a custom menu control that I am creating using C#. I am rendering
HTML from a StringBuilder in my control to add the needed JavaScript to the
HTML output. I need to have the JavaScript...
|
by: paul.phillips |
last post by:
Hi, I am a problem:
I have a custom control called DataView that holds a DataGrid object.
The DataGrid has an event attached (PageIndexChanged) now the problem
is that the event is not being...
|
by: neil S via DotNetMonster.com |
last post by:
I have a custom control with a textbox and dropdown list. The dropdown
list is hidden and acts as a data source for the textbox. When the user
enters text in the textbox, an onKeyup event is...
|
by: Girish |
last post by:
OK.. phew. Playing with data grids for the past few days has been fun and a
huge learning experience..
My problem. I have a requirement to display a gird with a gird. Within the
embedded grid,...
|
by: |
last post by:
Hi all,
Has anyone been able to write some custom javascript on the onclick event of
submit button to do certain things like disable submit button, only submit
form once etc. This was a breeze...
|
by: ThunderMusic |
last post by:
Hi,
I'm making a Custom Web Control and I'm wondering how I can insert
Javascript code into the head part of the document from within my web
control... I lloked at the methods of the...
|
by: centur |
last post by:
Hello.
I created simple asp.net application to search message history over
Office Live Communicator conversations.
I complete quite all job but stick with one thing - I have autosuggest
box...
|
by: rn5a |
last post by:
I have created a custom control button which when clicked displays a
message in the JavaScript alert dialog. I could successfully compile
the VB class file into a DLL & also could add it to the...
|
by: Tomasz J |
last post by:
Hello Developers,
How do create a custom WebControl (not UserControl), exposing OnClick event?
I reviewed countless examples found by Google, but came across nothing
helpful.
Below I attach...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |