|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Odin Smarty Rookie
Joined: 07 Mar 2013 Posts: 8
|
Posted: Sat May 02, 2015 7:59 pm Post subject: Smarty and responsive behaviors |
|
|
Hi,
I have a Smarty template which is responsive and I would like to hide/show some elements of the template on mobile or desktop - pretty common thing but... I don't want to just use display: none because it will be loaded/visible in source anyway so I would like to use smarty and {if}.
My question is, does Smarty have some solution for checking device resolution or window size? I think NO but maybe I'm wrong...
If answer is no, is it possible to use {if} to check if div with id have some specific class? I would be able to use javascript to check window.size and add class to div with specific id, for example:
Code: |
<div id="device" class="desktop" ></div>
|
and than use Smarty:
Code: |
{if #device class = desktop}
<div>Content visible only for desktop user!</div>
{/if}
|
That would be awesome. Thank you |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sat May 02, 2015 9:38 pm Post subject: |
|
|
Do you know the difference between server and client scripting? |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|