651 posts
  • Has been part of the Envato Community for over 3 years
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
ChapterThemes says

I’m creating a simple image zoom on hover effect with CSS transitions.

It all works well but – when loading the page for the FIRST time in Chrome you see the images zooming in from zero to correct height.

After some testing i came to the conclusion it happens because of my responsive stylesheet sets a max-width:100% to all images. But the max-width needs to be there for my responsive framework.

One solution a came across was to set classes that set the transitions properties to none and remove them with jquery after pageload. But i don’t like to put classes everywhere just for some stupid chrome loading issue.

Anyone with a tip or solution?

2196 posts
  • Located in Europe
  • Made it to the Authors' Hall of Fame
  • Had an item featured on Envato Market
  • Participated in a focus group or interview to improve the user experience on Envato Market
+10 more
revaxarts says

Have you tried to animate the max-width as well?

651 posts
  • Has been part of the Envato Community for over 3 years
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
ChapterThemes says

Have you tried to animate the max-width as well?

No, the image should just be the size it is without animating it.

It’s an annoying thing in Chrome. I’ve created the following solution for now:

Created a separate class with the css transition properties and that class with a :hover statement with the animating values.

Then with jquery i add the class to the image on hover – which also triggers the :hover of that class after jquery added the class.

There are no performance problems so i think i’ll keep with this one.

2196 posts
  • Located in Europe
  • Made it to the Authors' Hall of Fame
  • Had an item featured on Envato Market
  • Participated in a focus group or interview to improve the user experience on Envato Market
+10 more
revaxarts says

CSS get’s loaded immediately even if the page isn’t loaded. You can try to add the CSS at the very bottom of the page (is allowed since HTML5 – I think)

651 posts
  • Has been part of the Envato Community for over 3 years
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
ChapterThemes says

I tried but Chrome still executes it making a normal image animate like a slidein animation. Because img has max-width 100% or width 100% to it.

Chrome is the only browser who does that btw.

1291 posts
  • Has been part of the Envato Community for over 4 years
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 50+ items on Envato Market
+5 more
Smartik says
Maybe you shoukd disable the transtion for `max-width`?
img {
    transition: max-width 0;
    -moz-transition: max-width 0;
    -webkit-transition: max-width 0;
    -o-transition: max-width 0;
}
651 posts
  • Has been part of the Envato Community for over 3 years
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
ChapterThemes says

Maybe you shoukd disable the transtion for `max-width`?
img {
    transition: max-width 0;
    -moz-transition: max-width 0;
    -webkit-transition: max-width 0;
    -o-transition: max-width 0;
}

I had my hopes on this solution cuz it sounds quite nice – but unfortunately it somehow disables the whole animation in chrome. Again in chrome only..

501 posts
  • Has referred 1000+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+8 more
pixelentity says

been there too and solved in very the same way (js)

127 posts
  • Has sold $125,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has been part of the Envato Community for over 5 years
+4 more
Veuse says

Could you not simply add a wrapper around the image with the max-width, and set image to width:100%;?

.image-wrapper { width:100%; max-width:500px;}
.image-wrapper img { width:100%;}
651 posts
  • Has been part of the Envato Community for over 3 years
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
ChapterThemes says

Could you not simply add a wrapper around the image with the max-width, and set image to width:100%;?
.image-wrapper { width:100%; max-width:500px;}
.image-wrapper img { width:100%;}

Won’t work either because of the img width 100% – found out that chrome animates both the max-width and width.

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by