Comments (6)
This is the source: https://github.com/bfred-it/object-fit-images/blob/master/index.js
What's broken exactly? OFI doesn't run at all and therefore object-fit
isn't polyfilled, or the images disappear?
It's hard to find the issue without seeing your page/site
from object-fit-images.
from object-fit-images.
If it doesn't seem to run at all, either flickity is moving the images around or you're not waiting for the document to be ready. What's your initialization code? objectFitImages();
?
from object-fit-images.
Thanks for your help @bfred-it , got it sorted out. Not a conflict. It seems that the DOM wasn't ready. I was using
document.addEventListener('DOMContentLoaded', function () {
objectFitImages();
});
I added jQuery and used this instead and everything works as expected.
$(function(){
objectFitImages();
});
I'll post back if I find a reliable way to get it working with vanilla JS. Unless you have any ideas?
Thanks again! Super helpful.
from object-fit-images.
So it was because I was using async
that I was missing the DOMContentLoaded
event. Using this helper function from http://youmightnotneedjquery.com/
function ready(fn) {
if (document.readyState != 'loading'){
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
// and usage like so
ready(function(){
objectFitImages();
});
Everything seems to be working as it should. Thanks again. Sorry my fault.
from object-fit-images.
Glad you got it sorted out, thanks for sharing your solution!
from object-fit-images.
Related Issues (20)
- Assignment to read-only properties is not allowed in strict mode HOT 2
- Load event handler should get called when backgroundImage style is rendered. HOT 1
- Changing the src results in a "data-ofi-undefined" attribute. HOT 1
- Media Query images using `<source>` tag not working HOT 2
- Assignment to read-only properties is not allowed in strict mode HOT 13
- Fix documentation on es6 import HOT 7
- How to use this in angular project? HOT 2
- Error during tests HOT 2
- Test in IE with version 3.2.4 HOT 1
- IE11: Including the polyfill in two different libraries via ES6 imports then including both onto the page breaks it HOT 2
- > Assignment to read-only properties is not allowed in strict mode
- Doesn't support Edge 15 HOT 1
- react how to use ,ie11 is not working? HOT 1
- cloudinary videos is not working in IE 11 i.e object fit HOT 1
- Unable to use with Next HOT 2
- A request to have a de-initialization (cleanup) API HOT 2
- IE renders the svg object in background-image property HOT 10
- Uncaught (in promise) TypeError: _objectFitImages2.default.objectFitImages is not a function HOT 1
- Uses src when image has srcset HOT 4
- <picture> element in Edge HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from object-fit-images.