Overview
For resposive web designers: Ads are big trouble.
In the next article I will explain how to edit the JS script to a responsive design for your eBay ads.
The solution
Replace the document.write(‘\x3Csc… } in the following script with your ebay ads code, and you’ll support several sizes of the add for different screen width.
<script type="text/javascript" src='http://adn.ebay.com/files/js/min/ebay_activeContent-min.js'></script>
<script charset="utf-8" type="text/javascript">
var width = window.innerWidth || document.documentElement.clientWidth;
if (width >= 800) {
document.write('\x3Csc... }
else if ((width < 800) && (width > 350)) {
document.write('\x3Csc...
} else {
document.write('\x3Csc...
}
</script>
Happy coding…
Development Specialist, Artist and Activist
Personal Website
Thanks, this has worked well. Is the third entry “else” sort of a fallback in case the size of the screen cannot be detected?