So, I have an img tag in .image-wrapper I want to pan down on hover. Pretty basic use of CSS3 transition - based on here: http://designshack.net/articles/css/joshuajohnson-2/
Here's my stylus code:
// Portfolio
.portfolio-wide
.image-wrapper
height 300px
overflow hidden
.portfolio-wide
.image-wrapper img
width 100%
margin-top 0px
transition all 10s ease
.portfolio-wide
.image-wrapper:hover img
margin-top -100%
Stylus and Nib turn this into CSS with all the browser specific stuff.
My problem is IE<10 sucks and instead of panning down, it jumps right down - which looks broken. This feature isn't that important so I just want to disable it on IE<10.
How do I do that in Stylus? Seems like a pretty common thing but I couldn't find an example or documentation.
Suggestions? I tried some jQuery CoffeeScript to add/remove the style on page load, but it didn't work.
$(document).ready ->
# Like I don't have better things to do IE...
# determine if the browser supports transition
thisStyle = document.body.style
supportsTransition = true
(thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.OTransition !== undefined || thisStyle.transition !== undefined)
alert supportsTransition
# assign jQuery transition if the browser doesn't support
$if ( supportsTransition )
alert "here"
$(".portfolio-wide .image-wrapper:hover img").css('margin-top', '-100%')
The alerts were happening at the right time, but I didn't see the right effect in the code. In the code above, the margin-top style wasn't added, so the transition didn't happen. I tried .css('margin-top', '0px') to remove on !supportsTranstion, but it didn't work.
Anyways, It's a boondoggle on IE and I just want to disable it. Any suggestions?
Thanks!
Mike