此代码段几乎可以正常工作。在鼠标上,标题属性为hiddenon mouseleave title attribute restoreson单击标题属性restoreson lightbox overlay退出失败
当lightbox关闭时,它无法恢复title属性。再次单击图像会恢复图像标题。当lightbox覆盖关闭时,代码段中缺少什么可以恢复锚标题属性?
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\', \'\');
});
$(\'#lightboxOverlay\').on(\'close\', function () {
var $this = $(this);
$this.attr(\'title\', $this.attr(\'title-cache\'));
$this.attr(\'title-cache\', \'\');
});
});