RSS Feed/News How to correctly read XF variable with Javascript

Status
Not open for further replies.

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
24,717
Points
823

Reputation:

I need to run a code according to the screen size.

So I've put the JS inside XF var and if I "alert" or "console.log" I can see the variable, but when calling the variable in XF it returns nothing.

How to correctly read the XF variable in this case?

Code:

Code:
<xf:set var="$screen"><xf:js>window.innerWidth;</xf:js></xf:set>
<xf:if is="{$screen} > 650">
     ...... code .......
</xf:if>

Continue reading...
 
Status
Not open for further replies.
Top