I thought I'd share this for those that want to change the layouts of their shopping cart dependant on the screen size thats looking at the website.
Before I start, I realise that Ecwid works fine by itself with mobile devices by changes the layout to suit.
But I found that for those of us that use wordpress and themes that already do that, when viewing the store in my portable devices, the categories in thumbnail view would mean still having to scroll sideways to see everything. Also the bag if in float mode on the store normally, would take up quite a lot of space on the screen on the portable device.
So all of the above led me to working this out.
To change the grid layout on thumbnails so that it will go from how ever many you currently use to one per row, you need to change the normal javascript
Code:
<script type="text/javascript"> xProductBrowser("categoriesPerRow=3","views=grid(3,3) list(10) table(20)","categoryView=grid","searchView=list","style="); </script>
to
Code:
<script type="text/javascript">
if (screen.width <= 320) {
document.getElementById('ProductBrowser-1').className += ' ecwid-Mobile'
xProductBrowser("categoriesPerRow=1","views=grid(10,1) list(10) table(20)","categoryView=grid","searchView=list","style=");
} else {
xProductBrowser("categoriesPerRow=3","views=grid(3,3) list(10) table(20)","categoryView=grid","searchView=list","style=");
}
</script>
Then add this code to your Ecwid css file
Code:
.ecwid-Mobile img.ecwid-SpacerImage {
display: none !important;
}
You can play around with this for exactly how many items to show and such
The next item, was showing the bag on your site normally, and then hiding it when you're using a device
To do this you will need to change the normal javascript
Code:
<script type="text/javascript"> xMinicart("style=","layout=attachToCategories"); </script>
to
Code:
<script type="text/javascript">
if (screen.width <= 320)
{
xMinicart("style=","display:none !important");
}
else
{
xMinicart("style=","layout=floating");
}
</script>
Hopefully this is helpful for people, as it was something I discovered I wanted to achieve a few days ago when viewing my store on my iphone
to test
Please note, that to see this working in action, look at your site on the devices you want to see it change on. If you just try and resize the browser window you use on your computer, it wont show the change. The only reason I can think of for this is maybe because the screen resolutions settings on computers can't be reduced down to 320 pixels wide