CODE
$(document).ready(function(){
$('#Box10_main').hover(function(){
//mouse enters
$("#tool_10").css("display", "block");
}, function(){
//mouse leaves
$("#tool_10").css("display", "none");
});
position: {
viewport: $(window);
};
$(document).mousemove(function(event){
var mx = event.pageX+15;
var my = event.pageY+15;
$("#tool_10").css("left", mx + "px").css("top", my + "px");
});
});
how could I get the tooltips to stay inside the window? and i have looked around for an answer which was position: { viewport: $(window) }
but i have no clue on where to place this in the code
You don't have to add viewport or anything, just update this in your css
to
It will automatically wrap it and if you want to restrict it to some width just add
So final css changes are
Check http://jsfiddle.net/raunakkathuria/9c7fk/2/