Currently, I am working on a window-oriented application that operates similar to an operating system using jQuery. The issue I am facing is that when a window is clicked, it appends itself to the parent element, appearing on top of all other windows. However, if there is a button inside the window, it requires two clicks for the button to function properly. Does anyone have any insights into why this may be happening?
If you want to take a closer look at my project, you can visit:
When visiting the site, simply clicking the test button should trigger console.log("test")
.
The code involved is quite intricate, but the script responsible for appending the window is summarized as follows:
$(this.element).on("mousedown",function(e){
thisWindow.app.menubar.display();
if (!$(thisWindow.element).is(':last-child')) {
$("#desktop").append(thisWindow.element);
}
});
Please Note:
In case the link provided to my site becomes inactive or unavailable in the future, here is a fiddle which demonstrates the problem: http://jsfiddle.net/QhZr6/1/