The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.
Is there a way hide a 2D resource image widget upon launching an experience, and make it appear by clicking button widget? I'm new to Studio, so there may be a way to do this that I am missing.
Thanks!
Joe M.
Solved! Go to Solution.
Hi Joe,
Following is one way to hide a 2D resource image widget:
$scope.visibleImage = function() {
$scope.app.params.visibleparameter = true;
};
Upon launching the experience, the Resource Image widget is not visible. It is only visible when we click on the Button.
Hope this helps!
Hi Joe,
Following is one way to hide a 2D resource image widget:
$scope.visibleImage = function() {
$scope.app.params.visibleparameter = true;
};
Upon launching the experience, the Resource Image widget is not visible. It is only visible when we click on the Button.
Hope this helps!
Hi Yamini,
Excellent instruction - thank you! Would it be easy to apply the reverse and have the images set to invisible upon clicking the button again?
Thanks!
Joe
Hi Joe,
Yes, the reverse button action can be done in many ways. One way could be adding another application parameter such as counter and set it's default value to 0. Now update the function code as follows in Home.js:
$scope.visibleImage = function() {
if(($scope.app.params.counter % 2) == 0)
{
$scope.app.params.visibleparameter = true;
$scope.app.params.counter++;
}
else
{
$scope.app.params.visibleparameter = false;
$scope.app.params.counter++;
}
};
In the above function, I set the visible parameter to true for every alternative button click. I have used a counter to distinguish the clicks. Alternatively, you can use a boolean variable to track the clicks.
Hope this helps!
Awesome - thank you so much for the help!
Joe M.