The hovering event trail feature is not functioning in tsParticles, unlike in particlejs

I have two questions regarding the implementation of tsParticles in my React application. First question:

<Particles 
        id="tsparticles"
        options={{
          background: {
            color: {
              value: "black",
            },
          },
          fpsLimit: 60,
          interactivity: {
            detectsOn: "window",
            events: {
              onClick: {
                enable: true,
                mode: "push",
              },
              onHover: {
                
                enable: true,
                mode: "trail",
              },
              resize: true,
            },
            modes: {
              bubble: {
                distance: 400,
                duration: 2,
                opacity: 0.8,
                size: 40,
              },
              push: {
                quantity: 4,
              },
              repulse: {
                distance: 200,
                duration: 0.4,
              },
            },
          },
          particles: {
              
            color:{
                animation:{
                    enable:true,
                    speed:50,
                },
                value:"#f00"
            },
            links: {
                shadow:{
                    blur:true,
                    color:"#00ff00"

                },
                triangles:{
                    frequency: 1
                },
              color: "random",
              distance: 150,
              enable: true,
              frequency:1,
              opacity: 0.5,
              width: 1,
            },
            collisions: {
              enable: true,
            },
            move: {
                angle:{
                    offset: 45,
                    value: 90
                },
                attract:{
                    rotate:{
                        x:3000,
                        y:3000
                    }
                },
                gravity:{
                    acceleration: 9.81,
                    enable:false,
                    maxSpeed:1
                },
              direction: "none",
              enable: true,
              outMode: "bounce",
              random: false,
              speed: 6,
              straight: false,
            },
            number: {
              density: {
                enable: true,
                value_area: 1000,
              },
              value: 80,
            },
            opacity: {
              value: 0.5,
            },
            shape: {
              type: "circle",
            },
            size: {
              random: true,
              value: 5,
            },
          },
          detectRetina: true,
        }}
      /> 

There is a section for onHover with a key "mode" containing 8 different modes, which can be found on https://particles.matteobruni.it/. All other modes are functioning correctly except for the trail mode when using this code. Are there additional properties required for the Particles component?

Second question: Additionally, I have two div elements - one for the particles and another for text to display on top of them. I've achieved this using z-index and positioning.

I am looking to make the canvas height dynamic, occupying 100% height of its parent regardless of screen size. I attempted this by placing the Particles component within a div with a height set to 100%, but the canvas height decreases as the screen size shrinks.

Your assistance would be greatly appreciated. Thank you :)

Answer №1

Impressive! There's a plethora of information to cover here, but I'll do my utmost.

To begin with, let's talk about the config and mouse trail

In order to tailor the mouse trail to your liking, delve into the modes section within interactivity, where you can adjust the trail settings.

A demo is available here for reference: https://codepen.io/matteobruni/pen/abdpbBY

If more guidance is required, consult the appropriate documentation section:

Moving on to the second point, addressing canvas size

For a dynamically adjustable canvas size, employing the backgroundMode in the root options object proves most effective.

You can view an example here: https://codepen.io/matteobruni/pen/MWeqxNL

Enabling the background mode will establish the canvas style with a fixed position and the specified zIndex

Refer to the documentation provided here for further insights:

When utilizing the backgroundMode, it is recommended not to apply any styles to the encompassing div (the tsParticles target/container) for optimal results.

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

Tips for accessing the parent method within a jQuery AJAX success function

Similar Question: javascript how to reference parent element Hello everyone! This is my first time posting here. I have a question - how can I trigger alerts from a successful AJAX call? var page = { alerts: function (json) { if (json ...

Encountering a 405 error when attempting to send a request through an express route in a Next

After deploying my Express js routes in Next js on hosting, I encountered an error 405 when sending requests to the route. However, everything works fine when I test it on localhost. I'm puzzled by this issue. Can anyone help me understand what' ...

Utilizing :checked selector and toggle() function in jQuery

I'm facing an issue with my jQuery code where the CSS changes are not working as expected. When I test the code, it doesn't apply the CSS changes. If I remove the :checked and just use $("input"), then the CSS works but only when clicking on an i ...

Placement of Search Bar

After integrating a search bar into my website using code injection points, I am now attempting to relocate it below my site's tagline. The screenshot below illustrates what I am aiming for. You can visit my website at www.jobspark.ca <script typ ...

Sending a JavaScript value to PHP after a quiz has been completed

I've created a web page where users can take quizzes. These quizzes dynamically generate questions using JavaScript each time they are accessed. Disclaimer: I'm fairly new to JavaScript. Once the user completes the quiz, they receive their fina ...

The ng-model directive in Angular is effective for handling arrays, however, it may not

The implementation of the ng-model directive seems to be incomplete when dealing with string values in JavaScript. However, by using a list of dictionary objects and looping through them with ng-repeat, this issue is resolved. One reason for this behavior ...

"Troubleshooting: Why is my Bootstrap modal window only printing a

I've encountered an issue with printing the content of a Bootstrap modal window. Previously, the code I had was working fine but now it seems to be malfunctioning. Content is dynamically added to the form using appendChild() in a separate function. Ho ...

Is there a way to determine if a table cell contains overflowing text compared to another cell?

Is there a way to detect if the content of the fourth td overflows from the second td? I am looking for a method to determine which td has overflowed text and identify which td's text is overflowing. What approach can be used to determine which td i ...

Tips for changing the appearance of an entire table by overriding the table tr:nth-child styling

In the CSS code below, I currently alternate background colors for table lines by default and can specify individual rows to not alternate. Is there a way to implement this at the table level instead of per row? Essentially, I want to define something at ...

Hovering over a white background will darken the CSS styling

A stunning image on a dark background Displayed on Hover (right) An elegant picture with a white background Activated on hover (incorrectly) I would like it to have a darkened effect on the white background as well. CSS Styling .photo background: n ...

The upcoming developer manages to execute the program successfully, however, it continues to load indefinitely

Executing the command yarn dev consistently runs successfully in my VS Code terminal: $ yarn dev yarn run v1.22.19 warning ..\..\..\..\package.json: No license field $ next dev ready - started server on 0.0.0.0:3000, url: http://localho ...

The nightmare of Parent-Child Inheritance in JQuery/CSS is a constant struggle

Having difficulty implementing specific JQuery effects into a Bootstrap framework due to its extensive CSS causing issues. Created a test file named testjquery.html connected to a stylesheet defining a hidden element and activating the fade in of this ele ...

Navigating the process of returning a list from an AJAX method to a view through a controller in ASP.NET MVC

I need to retrieve a list from my controller and pass it to the view. Currently, I have the following script: function fetchNames(_id, _name) { $.ajax({ type: 'Post', url: 'GetNames/', data: { id: _id, name: _name}, su ...

Use jQuery to clear the content within a div element following the removal of an element

A dynamic generation of checkboxes is introduced to div1: $.each(json, function(idx, obj) { $("#tbl1").append('<input type="checkbox" id='+obj.firstId+' onclick=nextPopulate('+obj.firstId+'); >'); } Upon selection, ch ...

What is the reason that the dark theme does not function properly on toast without this essential line?

Upon implementing a dark theme on my website, I encountered an issue with toast messages not displaying properly in dark mode. After thorough investigation, I identified a specific line of code that needed to be added for the dark theme to function correct ...

Tips for streamlining distinct states and generalized state in UI Router

I've set up the following configuration in my JS app under the $stateProvider section using angular ui-router: .state('login', { url: '/login', templateUrl: 'app/login/login.tmpl.html', controller: &apo ...

React: Applying the active class to mapped elements

I have a component that iterates over an array to generate 10 navigation items. I want to implement an onClick method that will add an active class to the clicked item. Are there any best practices using Hooks or the newer React patterns for achieving this ...

Guide on invoking useEffect following state update within a component

I'm encountering an issue when trying to trigger a useEffect using a setState that was passed as a prop to a child component. I'm unsure if this is the correct approach. The code snippet looks like this: const Parent = () => { const [stat ...

Make a diagonally slanted border for a cell

Is it feasible to create a table with diagonal borders using CSS or jQuery, similar to the one shown below? I would welcome any ideas on how this can be achieved. ...

Explain the process of data binding with DOM elements

I'm intrigued by how jQuery has the ability to link arbitrary data with any DOM element without the use of HTML data attributes. $('#div_id').data('suffix', (count++)); In the Firebug HTML snapshot, I don't see any data attr ...