How to make a button link direct dependant on screensize?

I need to be able to make a button, that when clicked directs to one of two pages depending on the screensize of the user. For example if the user is on a mobile device, say <760px, they are directed to "pageA". Alternatively, the desktop user is directed to "pageB".

This is on a wordpress site, and I'd prefer to do this within a text widget (html input). Is that possible?

Answers


<style>
#two {display: none;}
@media (min-width: 760px) {
    #two {display: block;} /* or inline-block, as needed */
    #one {display: none;}
}
</style>

<a class="button" href="/mobile-page" id="one">My Button</a>
<a class="button" href="/desktop-page" id="two">My Button</a>

Need Your Help

Using WiX to create an IIS virtual directory

windows iis iis-7 installer wix

I'd ask this on the WiX mailing list, but it seems to be down.