Hello,
I've been building responsive sites for a little while now and so far everything is going great. However there's one technique I haven't figured out how to port to responsive and I can't find any sites that tackle it. That is css image rollovers.
Now 5 years ago or so css image rollovers were all the rage. "You don't need javascript to do rollovers!" was the big proclamation, and it was true and everyone was happy. Now in the new jQuery/Responsive reality, I haven't seen anyone try and get this working in a responsive layout.
So here's the problem.
In an old site I'd have a div like so
And some CSS like so. (This assumes the button has dimensions of 100px x 100px.)Code:<div id"home_button"><a href="home.php"></a></div>
Code:#home_button a:link, #home_button a:visited, #home_button a:active { background: transparent url("../images/home_button_background.jpg") no-repeat scroll 0 0; display: block; height: 100px; text-decoration: none; width: 100px; } #home_button a:hover{ background: transparent url("../images/home_button_background.jpg") no-repeat 0 -100px; }
In a responsive design it's not unreasonable to want <div id"home_button"> to resize dynamically based on device/viewport. However since the background image is based on pixel perfection, how can you resize the div and still get the background to reposition itself as desired?
Challenge: I know you can use things like jQuery etc... to get this working. But using a javascript library to fix something so simple seems like overkill. Preferably I'd like to keep this as simple as possible.
Any thoughts or ideas?



Reply With Quote





somedays I wish I could!

Bookmarks