Just a question that I am having trouble resolving using Google...
I have a web application I am developing where I have usernames attached to certain types of records. What I need to be able to do is add an event using data- attributes in html5 so that when the mouse hovers over the link in question it opens up an AJAX powered window showing user information such as can be seen in this link...
Now I have tried to access that URL and get a server error from the jQuery Forums, in addition searching Google brings up a large number of pages regarding jQuery powered static tooltips but nothing that I can find that will open a hovering layer such as in the attached example image.
I am open to doing this in vanilla JS however as most of the UI is powered by jQuery I was hoping there would be an existing jQuery plugin or a jQuery solution to my need.
Technical
I know that this is a very specific enquiry and I am only asking as I am having difficulty locating any answer myself using Google. Preference would be for an existing off the shelf plugin although if none is available would be happy to do this as a stand alone class run on page load using jQuery as the back end.
Thanks in advance.
Try the jQuery UI Dialog widget. You should be able to do something like this:
$(".selector").html("<p>Your HTML</p>");
$(".selector").dialog({
autoOpen: false
});
$(".trigger").hover(function(){
$(".selector").dialog("open");
});
If you want to load an external page into the dialog before opening it, you could try this:
$(".trigger").hover(function(){
$(".selector").load('external-page.html', function(response, status, xhr){
if (status == "error") {
$(".selector").text("Sorry, there was an error.");
}
$(".selector").dialog("open");
});
});
See the Dialog widget API documentation and the jQuery load method documentation for more information.