JS - How to target multiple scenes

Hi,
How can I target multiple scenes with this code, without having to duplicate the whole lot?

$(document).on(‘knack-scene-render.scene_450’, function(event, scene) {
$(“.kn-info-bar”).hide();
})

Cheers

1 Like

@Craig_Anderson, sent on the move so hope this works!:

const scenesForCode = ['scene_1', 'scene_2', 'scene_3'];

$(document).on(‘knack-scene-render.any’, function(event, scene) {

  if (scenesForCode.includes(scene.key)) {
    // Insert code here
  }

});

4 Likes

Perfect! Thanks for the quick reply Stephen.

1 Like

wow, simple question but big impact! tks for asking it and much for the solution guys!!
very useful for me.

2 Likes