Hvis du er ny til denne nettsiden, har du sannsynligvis ikke har lagt merke til. Men bakgrunnen du ser faktisk er noe nytt. Og tilfeldige. Og streames fra Flickr. Det er en ny plugg som jeg utvikler for WordPress kalt ‘WP Flickr Bakgrunn '.

Litt over to uker siden jeg endret mitt tema til Bevegelse av 85ideas, og ble fascinert av dens effektiv bruk av transparenter og bakgrunnen. Og siden jeg fort bli kjedelig å se på det samme, Jeg trodde ‘Hvorfor ikke gjøre denne bakgrunn random '? Flickr gir millioner av bilder, mange av dem under en Creative Commons Attribution License, og dette ville være en utmerket kilde for de tilfeldige bakgrunner. Så jeg begynte koding…

Interestingly, it wasn’t as straight forward as one would expect. After all, you could simply use a dynamically generated CSS style sheet with abackgroundelement pointing to a random Flickr photo. Right?

But small photos cascade and your website will look like a bad 1995 rendition of your first HTML page. And the large photos may be large, you end up staring at just a grain of sand instead of a beach.

CSS3, the brand-spanking new version of CSS style sheets, supports stretching of background images. Dessverre, not a single browser I have tried supports it. So I reverted to good-old image hacking, basically injecting the background in a negative Z-indexed <div> block at a fixed position.

Ja, that last sentence is a great conversation breaker. But trust me, it is the injection portion that’s trickiest. For one, I do not like it when plugins require me to manually modify files, let alone modify files in the first place. So I assume there are other people out there who think alike. So how can I change a WordPress theme without actually modifying its files? Enter Javascript, jQuery to be specific, and we are on our way to great trickery!

So in the end, WP Flickr Background will use Javascript to add a new background image overlaid by the actual (original) contents. And it works! At least, it does so with Opera 10, Firefox 3, Google Chrome 3, MSIE 8 and Safari 4. Hence I am now putting the plugin through a public Alpha test, waiting for complaints to roll in: “Your website looks weird” og “I’m getting Javascript errorsare some of the things I am expecting to see during testing, but hopefully there will be none! You will let me know, right?

If I am satisfied that there are no major issues with the plugin, then I will make it available for download. In meantime, I will be re-arranging a few things on the website once again to make room for the new plugin and a few others I am thinking about writing. So please excuse construction going on in the next few days!

Related Posts:

  1. WP Flickr Bakgrunn
  2. WP Flickr Bakgrunn versjon 1.0.2 (Beta) tilgjengelig
  3. WP Flickr Bakgrunn versjon 1.0.3 (Beta) tilgjengelig
  4. WP Greet Box autohide funksjonen
  5. Fancy WordPress Translations