Javascript 如何隐藏悬停时图像的标题
在这里,我将有一个图像的标题,我需要为其他目的这个标题。但我不希望那个标题显示在图片的悬停处。如能早日答复,将不胜感激。提前感谢。不要使用title属性,而是使用data属性应用它。这样就不会调用默认行为,但您仍可以出于自己的目的访问它Javascript 如何隐藏悬停时图像的标题,javascript,jquery,html,css,image,Javascript,Jquery,Html,Css,Image,在这里,我将有一个图像的标题,我需要为其他目的这个标题。但我不希望那个标题显示在图片的悬停处。如能早日答复,将不胜感激。提前感谢。不要使用title属性,而是使用data属性应用它。这样就不会调用默认行为,但您仍可以出于自己的目的访问它 <img data-title="Image Title" ... 不要使用title属性应用它,而是使用data属性。这样就不会调用默认行为,但您仍可以出于自己的目的访问它 <img data-title="Image Title" ... 不
<img data-title="Image Title" ...
不要使用title属性应用它,而是使用data属性。这样就不会调用默认行为,但您仍可以出于自己的目的访问它
<img data-title="Image Title" ...
不要使用title属性应用它,而是使用data属性。这样就不会调用默认行为,但您仍可以出于自己的目的访问它
<img data-title="Image Title" ...
不要使用title属性应用它,而是使用data属性。这样就不会调用默认行为,但您仍可以出于自己的目的访问它
<img data-title="Image Title" ...
如果可以,将标题移动到数据标题,这是一个自定义属性,可用于标题的其他用途
如果不能,可以使用这样的js
$("img").mouseenter(function(){
// Get the current title
var imgtitle = $(this).attr("title");
// Store it in a temporary attribute
$(this).attr("data-title", imgtitle);
// Set the title to nothing so we don't see the tooltips
$(this).attr("title","");
});
$(".element").mouseleave(function(){
// get the attribute back
var imgTitle = $(this).attr("data-title");
// Set the title back
$(this).attr("title","imgtitle ");
});
如果可以的话,可以将标题移动到数据标题,这是一个自定义属性,可以用于标题的其他用途
如果不能,可以使用这样的js
$("img").mouseenter(function(){
// Get the current title
var imgtitle = $(this).attr("title");
// Store it in a temporary attribute
$(this).attr("data-title", imgtitle);
// Set the title to nothing so we don't see the tooltips
$(this).attr("title","");
});
$(".element").mouseleave(function(){
// get the attribute back
var imgTitle = $(this).attr("data-title");
// Set the title back
$(this).attr("title","imgtitle ");
});
如果可以的话,可以将标题移动到数据标题,这是一个自定义属性,可以用于标题的其他用途
如果不能,可以使用这样的js
$("img").mouseenter(function(){
// Get the current title
var imgtitle = $(this).attr("title");
// Store it in a temporary attribute
$(this).attr("data-title", imgtitle);
// Set the title to nothing so we don't see the tooltips
$(this).attr("title","");
});
$(".element").mouseleave(function(){
// get the attribute back
var imgTitle = $(this).attr("data-title");
// Set the title back
$(this).attr("title","imgtitle ");
});
如果可以的话,可以将标题移动到数据标题,这是一个自定义属性,可以用于标题的其他用途
如果不能,可以使用这样的js
$("img").mouseenter(function(){
// Get the current title
var imgtitle = $(this).attr("title");
// Store it in a temporary attribute
$(this).attr("data-title", imgtitle);
// Set the title to nothing so we don't see the tooltips
$(this).attr("title","");
});
$(".element").mouseleave(function(){
// get the attribute back
var imgTitle = $(this).attr("data-title");
// Set the title back
$(this).attr("title","imgtitle ");
});
如果您想将标题用于其他目的,为什么不在标记中使用用户定义的属性呢?e、 g.user-title=“”等,并将该属性作为$('anyid').attr('user-title')获取;也许你应该从title切换到alt属性?不确定为什么需要标题。如果要将标题用于其他目的,为什么不在标记中使用用户定义的属性?e、 g.user-title=“”等,并将该属性作为$('anyid').attr('user-title')获取;也许你应该从title切换到alt属性?不确定为什么需要标题。如果要将标题用于其他目的,为什么不在标记中使用用户定义的属性?e、 g.user-title=“”等,并将该属性作为$('anyid').attr('user-title')获取;也许你应该从title切换到alt属性?不确定为什么需要标题。如果要将标题用于其他目的,为什么不在标记中使用用户定义的属性?e、 g.user-title=“”等,并将该属性作为$('anyid').attr('user-title')获取;也许你应该从title切换到alt属性?不知道你为什么需要一个头衔。