Comments (6)
with CSS media queries: http://www.w3schools.com/cssref/css3_pr_mediaquery.asp
from wp-tevko-responsive-images.
This test gives you insight in how to prevent multiple requests when using CSS media queries: http://timkadlec.com/2012/04/media-query-asset-downloading-results/
If you need to write the CSS in your functions.php (so you can use PHP to generate the URLs), you can use wp_add_inline_style to add it in a style block in the head.
from wp-tevko-responsive-images.
I'm looking for a background-image solution as well.
Based on this Fiddle;
http://jsfiddle.net/trixta/bfqqnosp/embedded/result/
It might be possible with lazysizes + ls.bgset.min.js plugin:
https://github.com/aFarkas/lazysizes/tree/gh-pages/plugins/bgset
from wp-tevko-responsive-images.
Be aware of the "lazy" part of the Lazysizes plugin. In other words, it's not only about responsive images but also about lazy loading.
You could indeed make it work with that JS plugin if you add some filters to replace the srcset
and sizes
attributes by data-bgset
and data-sizes
and to add the lazysizes class.
There is also the wp-lazysizes WordPress plugin which has as goal to work seamlessly with this plugin. Maybe it is going to take care of replacing the attributes, but that's more a topic for that repo.
I think background images on itself is outside the scope of this Responsive Images plugin, so I would suggest to close this ticket.
from wp-tevko-responsive-images.
Currently this plugin does a great job supplying the needed sizes for srcset and sizes. Would it be possible to just add a function to output the data-bgset? Regardless of lazysizes or any other plugin?
from wp-tevko-responsive-images.
Hey all, while I definitely see the use case for a responsive background image, I think it's a bit outside of the scope for this plugin. You can add some logic to your functions.php file by making use of the tevkori_get_srcset_array( ) function, which will return all of the necessary image sizes, which should set you up for automatic background size wrangling.
from wp-tevko-responsive-images.
Related Issues (20)
- Document remove_filter( 'the_content', 'tevkori_replace_data_sizes' );
- `the_post_thumbnail()` not returning `srcset` attributes. HOT 2
- Function to output responsive images in themes HOT 1
- Should we increase the default of 'max_srcset_image_width'? HOT 1
- Update documentation of 'wp_get_attachment_image_sizes()'
- Incorrect inline documentation HOT 2
- Problem with filter deprecation notices HOT 1
- Test test_tevkori_filter_content_images() failing against WP nightlies HOT 2
- Full URL path to files HOT 1
- Add custom srcset + sizes values to post thumbnails? HOT 1
- Incorrect srcset for retina images in 3.1.0 HOT 1
- Image tags without ending slash are never made responsive. HOT 4
- wp_calculate_image_srcset(): Reduce accepted aspect ratio difference HOT 2
- Default theme image options can make test fail HOT 2
- Responsive images broken on edited/imported content HOT 1
- Update documentation about plugin features HOT 2
- Problem with WooCommerce images HOT 4
- Use custom sizes attribute with the_post_thumbnail HOT 5
- Backport WP 4.4.1 fixes. HOT 1
- Deprecate/remove calls to `_wp_upload_dir_baseurl()`
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 wp-tevko-responsive-images.