when we hover to close button "X", how to open enquiry form?
Asked
Active
Viewed 57 times
-4
-
3Welcome to SO. Please take a [tour](https://stackoverflow.com/tour) of the [help centre](http://stackoverflow.com/help) to see [how to ask a good question](http://stackoverflow.com/help/how-to-ask) and what types of question are [on topic](http://stackoverflow.com/help/on-topic) for the site - this site is not a free code writing service, this is for people who have attempted some code and got stuck with a problem or error – Pete Apr 26 '19 at 11:19
-
yes it can be done. can you please tell what you have tried so far – thedudecodes Apr 26 '19 at 11:19
-
when we tryning to close the webpage and hover to that close button then one enquiry form should be open – Akshay Patil Apr 26 '19 at 11:37
-
1) We can't read your mind. 2) StackOverflow is NOT here to do work for you, it only helps you with concrete problems. 3) Provide your code, if you have any. – elveti Apr 26 '19 at 11:37
-
@AkshayPatil No, that is not possible. – str Apr 26 '19 at 11:38
-
Use `mouseleave` on `window` https://bradsknutson.com/blog/javascript-detect-mouse-leaving-browser-window/ – elveti Apr 26 '19 at 11:42
-
@elveti thanks for your solution i will try this. i exactly want this kinda solution – Akshay Patil Apr 26 '19 at 11:48
-
if anyone can provide example of this please do provide. I am not much experianced guy i am just a beginner – Akshay Patil Apr 26 '19 at 12:43
1 Answers
0
function addEvent(obj, evt, fn) {
if (obj.addEventListener) {
obj.addEventListener(evt, fn, false);
}
else if (obj.attachEvent) {
obj.attachEvent("on" + evt, fn);
}
}
addEvent(window,"load",function(e) {
addEvent(document, "mouseout", function(e) {
e = e ? e : window.event;
var from = e.relatedTarget || e.toElement;
if (!from || from.nodeName == "HTML") {
// stop your drag event here
// for now we can just use an alert
alert("left window");
}
});
});
Demo: https://unwillingfumblingchord--five-nine.repl.co/
Code: https://repl.it/repls/UnwillingFumblingChord or https://jsfiddle.net/m1Lkj5nt/2/

elveti
- 2,316
- 4
- 20
- 27