/    Sign up×
Community /Pin to ProfileBookmark

Javascript command via drop down Menu

I’m new to using Javascript, and I need help with a project I’m working on.

The issue I’m having is that I need to change what’s being rendered in a 3D model based on options available in a drop down menu. I just managed to get the drop down menu to change the material, but I need to figure out how to make it work with multiple materials off of the same drop down menu.

Here is what I have now:

[code=html]<div class=”variant-option” id=”js-mat-sel”>
<div class=”variant-option-title”>Finish: </div>
<select data-variant-option-name=”Finish”>
<option value=”none”>Select Finish</option>
<option value=”Silver” id=”silver”>Silver</option>
<option value=”Brass” id=”brass”>Brass</option>
</select>
</div>
</div>[/code]

[CODE]$( “#js-mat-sel” ).bind( “change”, function matchange(){
lapi.applyMaterialToMeshByName( “Silver 1”, “Group28884”);
});
[/CODE]

Currently, as is, the script changes from the base material to “Silver 1” when any option on the drop down menu is selected. I’d like it to display the material “Gold 1” when I select “Brass” on the Drop Down menu, and only display “Silver 1” when I select “Silver” from the drop down.

Additionally, it should be noted that I’m using a derivative of an [URL=”https://github.com/lagoa/API-Samples/blob/master/docs/lagoa_api.js.html”]existing API for the 3D rendering company, Lagoa[/URL].

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @Kyhan spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...