WordPress.org

Support

Support » Themes and Templates » Responsive » [Resolved] Mobile specific content?

[Resolved] Mobile specific content?

  • I’m trying to get the “featured” div on the first page to display a certain slider (basically just output a certain shorthand string) for mobile devices and another one for other screens. (The slider is too wide to look good on mobile devices.)

    I’ve tried to insert a javascript in the content field for the home page, but it fails to work properly. Does anyone have a clue on what I’ve done wrong? – Btw, I suck at javascript.

    <script language="javascript">
    	var mobile = (/iphone|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));
    		if (mobile)
    			document.write("[unoslider id=\'2\']");
    		else
    			document.write("[unoslider id=\'1\']");
    </script>

    I’d be grateful for any input anyone has. This has me a bit stumped.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Mobile specific content?’ is closed to new replies.
Skip to toolbar