We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

PLACING DIFFERENT ADS BASED ON SCREEN SIZE

How Do I?

bthom62's avatar
bthom62
164 posts
6 years ago
bthom62's avatar bthom62

WE HAVE A FULLY RESPONSIVE DESIGN WEBSITE. NOW OUR AD COMPANY WANTS TO HAVE ASLIGHTLY DIFFERENT LOOK ON THE MOBILE SITE.

BASICALLY ON A PLACEMENT ON THE LAYOUT.

IS THERE A WAY TO USE CONDITIONALS TO PLACE DIFFERENT AD CODES BASED ON SCREEN SIZE

Ie. More or less

If a regular site show this code, if mobile show this or show nothing at all

or….

Do I have to direct viewers to a mobile template (rather not do that, but….

       
Rob Allen's avatar
Rob Allen
2,950 posts
6 years ago
Rob Allen's avatar Rob Allen

I find it odd that you let an ad company dictate how your site should work - surely you should be telling them what you want?

Anyhow, you will probably need Javascript to detect the device width, then based on that insert whatever code is needed.

       
benoitlemay's avatar
benoitlemay
19 posts
6 years ago
benoitlemay's avatar benoitlemay

You can also use img scrset like explained here.. (i have nothing to do with this article.. i picked the first one i founded 😉

https://html.com/attributes/img-srcset/

Other example here..

https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_picture

       
JCOGS Design's avatar
JCOGS Design
71 posts
6 years ago
JCOGS Design's avatar JCOGS Design

I think you also asked this question in StackExchange, but in case not, an easy / simple way to tell if your site is running on a mobile device rather than a desktop is to you the Mo’Variables add-on which contains a set of early-parsed conditional elements … vis:

Early-parsed Mobile Detection Conditionals

{if is_mobile}
{if is_not_mobile}
{if is_tablet}
{if is_not_tablet}
{if is_phone}
{if is_not_phone}

HTH

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.