Replies: 2 comments
-
Hey there, I'm not sure if this will work or not, but I did notice one change from yours and the example: In your top example I see the path doesn't end with a '/', where as the example it does. Meaning it's adding the 'name' to the very end of that directory which most likely doesn't exist? const base = "C:/Users/User/Desktop/products/" + name; Hope that helps! |
Beta Was this translation helpful? Give feedback.
0 replies
-
@Hexa93 Please don't cross-post - it makes it harder to respond to you and splits the conversation. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone. I'm having a hard time trying to find out why the file directory won't work. I've followed this example with a few tweaks. My problem is with the slider buttons at the bottom, when I try to change the file, the site freeze (i.e. switchSrc doesn't switch the src).
I've used this function:
window.switchSrc = (element, name) => {
const base = "C:/Users/User/Desktop/products" + name;
modelViewer.src = base + '.glb';
modelViewer.poster = base + '.webp';
const slides = document.querySelectorAll(".slide");
slides.forEach((element) => {element.classList.remove("selected");});
element.classList.add("selected");
};
As well as this one:
const baseURL = "C:/Users/User/Desktop/products/";
window.switchSrc = (element, name) => {
const src = baseURL + name + '.glb';
const poster = baseURL + name + '.webp';
modelViewer.src = src;
modelViewer.poster = poster;
const slides = document.querySelectorAll(".slide");
slides.forEach((element) => {element.classList.remove("selected");});
element.classList.add("selected");
};
Neither seems to work. It is not reading the directory correctly.
Thank you in advance for any further help.
Beta Was this translation helpful? Give feedback.
All reactions