solved Is It Possible You Use An IF statement like this?

derrickhand300
@derrickhand300
9 years ago
1,353 posts
I have a rss slider on a page-On desktop its set to 450px but thats too much for mobile device...I was thinking maybe I could using the following to resize it for mobile devices
 this._boxId = boxData.boxId;
//       this._boxWidth = boxData.width ? parseInt(boxData.width) : 0;
       this._boxWidth = 450;

          {if jrCore_is_mobile_device()}this._boxWidth = boxData.width ? parseInt(boxData.width) : 0;
       this._boxWidth = 320;{/if}

Does not seem to be working-is there a way to do this?
Thanks
updated by @derrickhand300: 12/22/16 11:55:59AM
douglas
@douglas
9 years ago
2,800 posts
It might be better to set a variable to the size you want depending on the device being used... ie.

{if jrCore_is_mobile_device()}
{assign var="boxwidth" value="320"}
{else}
{assign var="boxwidth" value="450"}
{/if}

Then you can use that single variable for the this._boxWidth value...

this._boxWidth = {$boxwidth};

Depending on the rest of your code, you may also need to use literal tags.

ie.

{literal}
the beginning of your code here up to
this._boxWidth = {/literal}{$boxwidth}{literal};
the rest of your code here...
{/literal}

Hope this helps!


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos

updated by @douglas: 03/10/16 02:23:56PM
derrickhand300
@derrickhand300
9 years ago
1,353 posts
Thank you Douglas-You are always a great help man!
douglas
@douglas
9 years ago
2,800 posts
Your welcome! :)


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos

Tags