I want a custom title show.
Example: At first if the mouse is over title, the title doesn't show, then if I press and hold CTRL button and mouse over title, it will appear.
The question here is how can I do that ?
I want a custom title show.
Example: At first if the mouse is over title, the title doesn't show, then if I press and hold CTRL button and mouse over title, it will appear.
The question here is how can I do that ?
You can play around with keyup and down feature (for ctrl its 17) and also mouse over feature and simply alter css using jQuery. Here is a relevant link -- How to detect control+click in Javascript from an onclick div attribute?
I solve my problem with custom title, css and mouseover and mouseout events.
$("p").mouseover(function(evt) {
if(evt.ctrlKey){
console.log("test")
var title = $(this).attr("t-hide");
$(this).removeAttr("t-hide").attr('data-title', title);
}
}).mouseout(function() {
var title = $(this).attr("data-title");
$(this).removeAttr("data-title").attr('t-hide', title);
});
p:hover {
position: relative;
}
p[data-title]:hover:after {
content: attr(data-title);
padding: 4px 8px;
position: absolute;
left: 0;
top: 100%;
white-space: nowrap;
z-index: 20px;
box-shadow: 0px 0px 4px #222;
background: #e4e4e4;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p t-hide="Title Custom"> test </p>
</body>
</html>
note: I do not recommend default title, when the mouse is over and you press some key the title is hidden...