Jump to content

Force stopping displaying img alt on hover


Recommended Posts

Hello,

 

is there a way how to force stop displaying img alt on hover? Some way instead of deleting alt from code?

 

Thank you very much,

 

Daniel

 

In the file global.js at the very end, add this code

	$(document).ready(function(){
				(function($){
					$.fn.hideTips = function(){
						return this.each(function(){
							var $elem = $(this)
							var savealt = $elem.attr('alt');
							var savetitle = $elem.attr('title');
							$elem.hover(function(){
								$elem.removeAttr('title').removeAttr('alt');
							},function(){
								$elem.attr({
									title:savetitle,
									alt:savealt});
							});
						});
					};
				})(jQuery);
				$(function(){
					$('a').hideTips();
					$('img').hideTips();
				});
			});
Link to comment
Share on other sites

Hello,

 

is there a way how to force stop displaying img alt on hover? Some way instead of deleting alt from code?

 

Thank you very much,

 

Daniel

 

Actually when you hover over an imag, which is displayed is not img alt it's img title. To force remove the title of img you can add this javascript code your js file:

$(document).ready(function(){
    $('img').attr('title','');
});

if you also want to remove alt then

$(document).ready(function(){
    $('img').attr('alt','');
});
Link to comment
Share on other sites

 

Actually when you hover over an imag, which is displayed is not img alt it's img title. To force remove the title of img you can add this javascript code your js file:

$(document).ready(function(){
    $('img').attr('title','');
});

if you also want to remove alt then

$(document).ready(function(){
    $('img').attr('alt','');
});

 

Forced is not necessary, it's bad for SEO

 

When hovering it was necessary...

  • Like 1
Link to comment
Share on other sites

Forced is not necessary, it's bad for SEO

 

When hovering it was necessary...

 

I don't think it would affect SEO because this javascript it only happens when you browse the site on an web browser with javascript support. The alt and title tags are still in website source code (which search engine read)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...