Git Product home page Git Product logo

Comments (4)

fregante avatar fregante commented on June 12, 2024

Thanks for providing a JSFiddle! You're missing a ; after the font-family line. Notice how position has the wrong color.

screen shot 2017-11-07 at 01 25 59

from object-fit-images.

bradroberts avatar bradroberts commented on June 12, 2024

I copied it from the example on the readme! LOL :) I fixed that, but it's still using the src rather than the srcset in IE 11.

Thank you for the quick reply.

from object-fit-images.

bradroberts avatar bradroberts commented on June 12, 2024

Any thoughts on what I might be doing wrong? I've tried everything I can think of and even looked through the source, but I can't figure it out. I appreciate your time.

It should be showing a green image (srcset), but in IE 11 it shows the red image from src. https://jsfiddle.net/4bvd2wum/3/

from object-fit-images.

bradroberts avatar bradroberts commented on June 12, 2024

Ok. I'm a moron. Object-fit-images is doing its job just fine - fitting the image to its container.

My issue is that IE does not support srcset. Browsers that do support srcset, set a currentSrc property on the image after deciding which image to use. Object-fit-images uses the currentSrc property (falling back to src) to determine the image to use.

So, if you're using srcset you need an additional polyfill - Picturefill. If I had read the documentation thoroughly I would have caught this. Object-fit-images works with Picturefill to use the desired image from srcset.

Working Fiddle

@bfred-it Feel free to correct anything I've said that's incorrect. Thank you again for your help and for your work on this script!

from object-fit-images.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.