Ensure that the three.js script remains in a fixed position on a page that can be

Is there a way to make a 3D model created with three.js have a fixed position on a scrollable page, like a background while the rest of the content scrolls normally? Are there any CSS techniques or additional script elements that can be used to achieve this effect?

Here is the current website for reference: trhidouan309.barzalou.com/Barzalou/personnelle.html

Just a heads up, I am aware that my 3D model is still a work in progress.

Answer №1

To ensure your three.js model is displayed correctly on the page, you can (a) set the canvas rendering the model to 'position: fixed' and adjust its positioning, then (b) give the menu a higher z-index so it appears above the canvas.

For an example, refer to this code snippet: http://jsfiddle.net/shawnoakley/s8a1ex9d/13/

Here is an example of the CSS to achieve this:

canvas {
  position: fixed;
  top:50%;
  left:-20px;
  height:100px;
  width:100px;
}

ul {
    position: absolute;
    z-index: 2;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Challenges encountered when inserting nested data into MongoDB

I am currently in the process of constructing a database for a giveaway bot using MongoDB. When a new giveaway is initiated, the bot executes the following code to add the giveaway details to the database: const {mongoose} = require("mongoose") c ...

What is the best way to transfer information to a different component using Vue router?

At the moment, I have a component that is displayed on the page. When I check the this.$router variable inside this component, I notice that the full path property is '/hello/reports?report=3849534583957' and the path property is '/hello/rep ...

a single column with a div of varying height using flexbox

I need to create a div with a height of 120px using only the CSS property display: flex. I am not allowed to use float and can only use div elements. Here is the code I have so far, but I'm unsure how to achieve the desired outcome: .flex-containe ...

Storing a string in localStorage versus $localStorage in Angular 1 yields distinct value differences

I have encountered an issue in my angular controller where I am trying to save a token returned from an API endpoint as a string. In this example, I have used the variable testData instead of the actual token. var testData = "testdata" $localStorage[&apo ...

Is there a way to alter a form element based on the selected image?

Below is a code snippet that allows the price in the 'price' div to change based on user selection. <script type="text/javascript"> function showprice(e){ document.getElementById("price").innerHTML = e.getAttribute(&apo ...

showcasing real-time webcam information within an HTML web application

I have successfully integrated my webcam data live into my web application using the following code snippet. The live feed from my webcam is now visible on the webpage. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta ...

JavaScript issue causing input fields to malfunction and clear text boxes

I apologize for the simplicity of this question, but I am struggling with an issue and seeking help. Here's the problem: my calculate() method is not clearing text input as expected when testing my page. Below is the HTML markup and script: <!DOC ...

How to obtain the height of the parent screen using an iframe

Imagine a scenario where a div contains an image that is set to perfectly fit the height of the screen. This setup works flawlessly, with one exception - when placed within an iframe, the height of the div adjusts to match the content's height rather ...

What is the best way to align a form in the center of a page both horizontally and vertically

Currently, this is the HTML code I am working with: <body> <form id="form_login"> <p> <input type="text" id="username" placeholder="username" /> </p> ...

After inserting the Telerik component, the code <% ... %> is throwing an error

I have a webpage with ASPX that utilizes JavaScript and ASP components without issues. However, after adding a Telerik combobox, I encountered an error: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %& ...

What is the process of creating Vue.js single file components and incorporating them into a non-single page application?

Currently, I am in the process of developing a web application (specifically ASP.NET Core 2 MVC) that is not a single page application. Vue.js is being used to enhance the front-end functionality through a Vue instance. As the project progresses, there is ...

Incorporate Text, HTML, and Embed Images into PHPWord

I am currently utilizing PHPWord to create word documents using PHP. I have a specific content format that I need to adhere to, as shown below: Title Description Image1 Image1 Description(HTML CONTENT) Image2 Image2 Description(HTML CONTENT) As of now ...

Issue encountered while executing npm command: "Module 'npmlog' not found"

Today marks the beginning of my first job, and as I was setting up my development environment on my Mac (OSX) by updating node and npm, something went awry. Whenever I attempt to use npm in my command line (npm init, npm install, etc.), I am confronted wit ...

Smooth Div Scroll experiencing display issues

Trying to integrate the smooth div scroll, specifically the "Clickable Logo Parade" found at: Successfully implemented it on a blank page exactly as desired, but encountering issues when inserting it into the current layout. Could something be causing int ...

Symphony 5 and Encore: Issue with Bootstrap JS Loading

Encountering issues while trying to integrate Bootstrap's js with Symfony 5, encore, stimulus, etc... All required dependencies like jquery, popper, corejs are installed and functioning, except for Bootstrap's JS components. The compilation of ...

Increase the spacing around the content in a textfield

I'm trying to figure out how to prevent text in a textfield from extending all the way to the end of the field. My setup includes a textfield with a background image and a button positioned on the right side of the textfield. I want to ensure that the ...

Switches in a React-Native ListView are not refreshing properly

Situation: I encountered an issue with a ListView of Switches Problem: The Switches are not changing state when pressed. When debugging, each switch appears to be checked momentarily after the setValue function is called, but then reverts back to unchecked ...

Unique styling for underlines in pop-up with custom CSS

When exploring my codesandbox project, I encountered 2 questions: How can I create a custom underline CSS similar to the UI image below the file name and trash icon? I tried using text-decoration:none, but it doesn't match the UI. How do I center a U ...

What is the best way to integrate asynchronous computed observable with several concurrent $.ajax requests?

I'm currently working on implementing an asynchronous computed observable following the guide provided here. While I have successfully achieved this for a single ajax call, I am facing a challenge in figuring out how to perform multiple ajax calls in ...

The jCapSLide Jquery Plugin is experiencing compatibility issues in Chrome browser

While this JQuery plugin works perfectly in Internet Explorer and Firefox, it seems to be malfunctioning in Chrome. The plugin is not being recognized at all by Chrome, and the captions are appearing below the image instead of on top with a sliding effect. ...