Displaying stack based on condition

Fellow weavers, I could need a bit of help. In a projectile I work with other people, and variables are filled using Ajax and accessible in the project. One of these contain a value, and if this value is “999” nothing needs to be done/displayed. I am looking for a stack that can test this value (in script) as a pre-condition and based on outcome display an embedded stack or not.

I have found some stacks that can test browsers or screen size before executing embedded stacks, but am unable to find a suitable solution for this. Are you aware of a stack that is able to test on this type of condition before displaying the content of the stack?

Thanks in advance for replies :+1:t2:

Nobody with a direction to take :bow:?

Perhaps try rephrasing your original question.

I get the general principle that sometimes you want a stack to show and sometimes you don’t. However, Based on your current description I can not visualize the setup that you currently have or the exact setup you are looking to achieve.

There is a product called Mobilize that will let you target specific devices for your site. Use this and create duplicate sites with the changes you need.

That’s all I got.

i doubt that you’ll find a stack to do this. why?

because if you want/need-to/know-how-to run a javascript then doing so based on the width of the page is not a big leap. and conversely the folks that look to accomplish complex tasks in stacks usually aren’t very interested in running scripts.

i think if you’re comfortable with scripting you should look into writing this one yourself.
i did a search for “run script based on screen size” and Stack Overflow gave me this. it’s pretty simple jQuery stuff.

if ($(window).width() < 960) {
   alert('Less than 960');
else {
   alert('More than 960');
1 Like

One way to do it would be to include some javascript that looks for the HTML generated by the stack in question, and removes it if your condition is true (the value is “999”).

You can manually add JS to your site in the inspector window. Select the HTML Code and JavaScript tab in the inspector.

This page shows roughly what the code would have to look like.

Beware that I’ve never actually done anything like this, so I’m just guessing that it would work, and doubtless there are many small problems that would have to be solved along the way.

Thanks all for the food for thought @Nick @isaiah @LaPan @BrandonCorlett :+1:t3:. I am taking the script-route using the display-function of a defined element based on the value “999”. This seems to work when added directly to a generated index.php file, now trying to incorporate it properly in the projectfile.

:smile: Now I understand what’s happening.