Answer the question
In order to leave comments, you need to log in
Display images based on screen size in Wordpress using Jquery?
Hello.
I use the plugin from here
I connect scripts:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="http://site.ru/wp-content/themes/mythemes/data-img.js"></script>
<script>
$(function(){
$('.data-img').dataImg({
sml: 310,
med: 630,
lrg: 800,
resize: true,
bgImg: true
});
});
</script>
<img
class="data-img"
src="<?php the_post_thumbnail(); ?>"
data-sml="<?php the_post_thumbnail('thumbnail'); ?>"
data-med="<?php the_post_thumbnail('medium'); ?>"
data-lrg="<?php the_post_thumbnail('large'); ?>"
>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question