-1

I'm working on improvements for my Easing Slider WordPress plugin and one of the common requests I get is to add support for background sliders, etc.

I'm looking into using background images as I find myself using background-size: cover a lot to have responsive hero images, etc.

I intend to keep the markup as is, including the HTML img with title and alt tag, only it'll remain hidden using display: none. I'll then have the JS add it as a background image for that slide. This allows me to keep the preloading intact too.

What are the SEO implications of this? Is this a bad approach? I don't see another way of reliably achieving the behaviour of background-size: cover.

Matthew Ruddy
  • 905
  • 4
  • 17
  • 31

1 Answers1

0

If you only set display: none in javascript, it will not affect SEO.

e-neko
  • 1,226
  • 9
  • 13
  • Are you sure? Do you have any evidence that this is the case? – Chris Herbert Feb 05 '15 at 01:55
  • Search bots don't run javascript at all. There are multiple such answers on SO, for example http://stackoverflow.com/questions/1547426/google-seo-and-hidden-elements and http://stackoverflow.com/questions/22313672/seo-display-none – e-neko Feb 05 '15 at 02:04
  • 1
    Search bots absolutely run javascript, though I don't think it's public to what extent they run it. The accepted answer to your second link includes this: "Google has changed a lot since the days when hiding content with CSS/JS could dupe them" – Chris Herbert Feb 05 '15 at 02:05
  • The rule has always been, and still is: if your change is cosmetic, i.e. affects presentation, but not the actual content of your site, and is not there to deceive the user or the search engine, it is ok. – e-neko Feb 05 '15 at 02:10
  • The question is how the search engine determines whether it is purely cosmetic. Certainly you should not try to fool the user, but I don't know know if you can be sure that Google will understand your intentions when you hide content in javascript. – Chris Herbert Feb 05 '15 at 02:12
  • The rationale is that today, display:none is widely used in any sort of somewhat dynamic site, either in css or by javascript. Therefore, it should be only penalized when hiding SEO spam content. However, only Google knows how it will process that. – e-neko Feb 05 '15 at 02:50
  • If you want to be really safe, use javascript to simulate the requested background behavior, i.e. by calculating the image size and sizing it accordingly, clipping to container if needed. – e-neko Feb 05 '15 at 02:52