This code snippet is almost working.
on mouseenter title attribute is hidden.
on mouseleave title attribute restores.
on click title attribute restores on lightbox overlay exit it fails
When the lightbox closes it fails to restore the title attribute. Clicking a second time on the image does not restore the image title.
What is missing in the code snippet to be able to restore the anchor title attribute when the lightbox overlay closes?
jQuery(document).ready(function($) {
$(‘a[title]’).on(‘mouseenter’, function () {
var $this = $(this);
$this.attr(‘title-cache’, $this.attr(‘title’));
$this.attr(‘title’, ”);
});
$(‘a[title]’).on(‘mouseleave’, function () {
var $this = $(this);
$this.attr(‘title’, $this.attr(‘title-cache’));
$this.attr(‘title-cache’, ”);
});
$(‘a[title]’).on(‘click’, function () {
var $this = $(this);
$this.attr(‘title’, $this.attr(‘title-cache’));
$this.attr(‘title-cache’, ”);
});
$(‘.lightbox’).on(‘click’, function () {
// restore anchor title attribute
});
});