What is the best way to mobile optimize my Wordpress blog that is image heavy without having to do device specific image editing? The general structure of my posts is something like this:
<div class="post" id="post-ID">
<div class="top_o_the_post">
<h2><a href="My URL" rel="bookmark" title="My Title">My Title</a></h2>
<small>My Sub-title</small>
</div>
<div class="entry">
<p>Some Text</p>
<p>More text</p>
<p>Some more text<br>
<table class="pics">
<tbody><tr>
<td>
<a href="My Image URL"><img src="My image src" alt="Foo" width="729" height="427" class="alignnone size-full wp-image-92687"></a>
</td>
<td>
<a href="My Image URL"><img src="My image src" alt="Foo" width="729" height="427" class="alignnone size-full wp-image-92687"></a>
</td>
<td>
<a href="My Image URL"><img src="My image src" alt="Foo" width="729" height="427" class="alignnone size-full wp-image-92687"></a>
</td>
</tr>
</tbody></table>
</div>
</div>
If you have some kind of image preset creation module installed you can make mobile friendly (smaller, lighter) image preset and then serve those images to mobile client by modifying SRC. On you example code transformation would look something like:
$(".//table[@class='pics']") {
$(".//img"){
remove("@width")
remove("@height")
attribute("src"){
value(){
replace("desktop-folder-name", "mobile-folder-name")
}
}
}
}
Also it would be good idea to make images responsive to various screen sizes. So in your SCSS you would want to have something like this:
.pics{
img{
width: 90%;
max-width: 480px;
display: block;
margin: 10px auto;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With