Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

Make color switching for cars when you click on

Timmy

New Coder
Hello. There is a small task. Make color switching for cars when you click on the corresponding color thumbnails. I made one machine work. The task is to make the switching of colors work for the second machine. Now the colors of the second car are changing, but they are dependent on the thumbnails of the color of the first car)) Apparently, somehow this changes in the simplest way in the script code that I added, but I can’t figure out where)) Here is the project. Copy of Copy of Автомобили Москвич в КАН АВТО на выгодных условиях!
 
Hi.

First you should fix these problems to make things easier for yourself.

Code:
Failed to load resource: the server responded with a status of 404 ()
3test:179 Uncaught TypeError: Cannot read properties of undefined (reading '0')
    at changeSldPh (test:179:23)
    at HTMLAnchorElement.<anonymous> (test:201:3)
    at HTMLAnchorElement.dispatch (jquery-1.10.2.min.js:4:14129)
    at v.handle (jquery-1.10.2.min.js:4:10866)
css2:1          Failed to load resource: the server responded with a status of 404 ()
DevTools failed to load source map: Could not load content for chrome-extension://gpmlagmcbcnjhkdjiofoenkfbaclgjkk/content-scripts/identity-protection/compat.module.js.map: Järjestelmävirhe: net::ERR_BLOCKED_BY_CLIENT

Then there is few other things you should consider when building something like this.

You have both car images on same div-container. They are not seperated in any way.

1. Set main "car container" div.
2. Set "upper car container" div for the upper car. Use proper name/id for this and the for javascript create a proper function which follows this precise container. Close this upper container after you have included images, text etc on it.
3. Set up "lower car container" for the bottom car. Use proper name/id for this and the for javascript create a proper function which follows this precise container. Close this div also, just as above.
4. Close main container.

It is possible to create js function which works for both containers, but based on your question i think this is easier approach. It works, that counts.
 

Buy us a coffee!

Buy me a coffee.
Back
Top Bottom