Body-end syntax Help

Hi Guys

So I can get a welcome banner to load using the code on github, and I can get highlights with mouseover to work, but not at he same time!!!
as I am not a coder I know it is probably something simple but I just can’t combine both features into the body-end html.

I have pasted the highlights code into the “script” section of the body-end file which already has the banner script,

Sorry Battling to get the banner code pasted into this post

Highlights Code
const viewer = WALK.getViewer();

function handleHoverChanged(material, hoverActive) {
if (hoverActive) {
document.body.style.cursor = ‘pointer’;
material.emissive = true;
material.emissionStrength = 2;
viewer.requestFrame();
} else {
document.body.style.cursor = ‘’;
material.emissive = false;
viewer.requestFrame();
}
}

viewer.onMaterialHoverChanged(‘Podium_Nam’, handleHoverChanged);
viewer.onMaterialHoverChanged(‘Podium_Nam_OofE’, handleHoverChanged);
viewer.onMaterialHoverChanged(‘Podium_ZA’, handleHoverChanged);
viewer.onMaterialHoverChanged(‘Podium_ZA_OofE’, handleHoverChanged);
viewer.onMaterialHoverChanged(‘play_button_stage’, handleHoverChanged);
viewer.onMaterialHoverChanged(‘Podium_Red’, handleHoverChanged);
viewer.onMaterialHoverChanged(‘Text_i_button’, handleHoverChanged);
viewer.onMaterialHoverChanged(‘Text_i_button_bg’, handleHoverChanged);
viewer.onMaterialHoverChanged(‘play_button’, handleHoverChanged);

Is your final file called body-end.html? (The screenshot shows body-end.txt)

The problem is likely do to the line:

var viewer = WALK.getViewer();

conflicting with the earlier line:

const viewer = WALK.getViewer()

you can remove the line with the var and see if it helps. Also if you open JavaScript console (F12) in Chrome it should display an error with some hint what is the cause (you can also upload the scene so we can take a look at the console and the error).

The txt files were just an attempt to upload and post.

So I deleted
var viewer = WALK.getViewer()
but this did not work

But deleting
const viewer = WALK.getViewer()
did the job, seems ok

Here is the scene, Audio needs tweaking, for another thread
https://my3ideas.shapespark.com/stadio_sbs_graduation/

1 Like