Adjust the svg rate using jQuery or JavaScript

Seeking help with a gauge I found on CodePen - struggling to adjust bubble values...

<path id="Fill-13" fill="#F8B50F" d="M3.7 88.532h26.535v-#.795H3.7z"/>

Can change the bars in JS, but not the bubbles using jq/js.

Adjust the gauge with values between 0 and 12, but no effect on bubbles.

Check out the CodePen here: https://codepen.io/sondik/pen/pdypaM/

Answer №1

Here is the code snippet from your codepen:

HTML

<g id="liquid">
    <path id="Fill-13" fill="#956" d="M3.7 88.532h26.535v-2.738H3.7z"/>
    <path id="Fill-14" fill="#956" d="M3.7 88.532h13.267v-2.738H3.7z"/>
</g>                                                      ^^^^^

I noticed that changing the value of 2.738 to 1 allows for better manipulation of the js numbers.

<path id="Fill-14" fill="#956" d="M3.7 88.532h13.267v-1H3.7z"/>

Javascript

tlBubbles.staggerTo(
    bubbles,
    0.8,
    { y: -20, ease: Power2.easeOut, scale: 0.5, autoAlpha: 0 },
    0.4
);

The position of the bubbles changes when you adjust the y value.

tlLiquid
    .set(liquid, { transformOrigin: "50% 100%" })
    .to(liquid, 4, { scaleY: 10, ease: Elastic.easeInOut.config(1, 0.4) });

By setting the HTML code to 1 for every 10 in the scaleY, you can create a "fluid level meter."

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

Angular has developed a content script that automatically fills in user passwords on forms

I have developed a content script extension that automatically fills in user and password fields on webpages. It works perfectly fine on regular forms like the one below - <input name="userId" class="form-field" id="userId" placeholder="Username" autoc ...

Can the title of a page be modified without using HTML?

Is it possible to update the title of my website directly from the app.js file? (I am utilizing node.js and express.js) ...

Scrolling to a specific position on a page when a Vue 3 component appears is a must-do for

When I click a button, my basic form component appears without using the router. I would like the scroll position of the form to automatically move down slightly (for example, on the y-axis at 40) once it is displayed. However, I am unsure of how to achi ...

Requesting data from a server using jQuery's AJAX functionality

Currently, I am utilizing the following piece of code for an ajax call: $('#filter').submit(function(){ var filter = $('#filter'); $.ajax({ url:filter.attr('action'), data:filter.serialize(), // form ...

Is it okay to make multiple calls using jQuery/AJAX if confirmed?

I am currently working on an ajax feature to delete a comment. Before the deletion process is executed, I prompt the user for confirmation. However, there seems to be an issue where if the user initially selects 'CANCEL' and then decides to proc ...

transforming JSON information into tables on a webpage

Can someone help me with the challenge of incorporating a massive JSON file into an HTML table? I am encountering an issue where I continuously receive the error message Uncaught TypeError: v.forEach is not a function. Any guidance would be greatly appreci ...

I'm curious, what is the exact function of ...state?

Just dipping my toes into NgRx (redux) within Angular and I'm a bit puzzled by the use of ...state in the code snippet below. My understanding is that it functions as spread operator, but I can't grasp why the data attributes from the Interface S ...

Is the scaling of a div with an image affected by odd pixel sizes?

My goal is to create a responsive grid with square images, where the first image is double the size of the others. While I can achieve this using jQuery, I am curious if there's a way to accomplish this purely with CSS. Grid: Here's an example o ...

Teaching sessions along with the implementation of functions

I've created a set of input fields with the class replaceInput. The idea is to have a simple function that clears the value when the user focuses on the field, and then returns it to 'X' if the field is empty on focus out. My query is, coul ...

What is the purpose of the jQuery json.text method?

I am working on creating a connect page where users can view content from various social media platforms such as Twitter, Facebook, and YouTube. Currently, I am using the getJson function in jQuery to retrieve data from the Twitter API at . However, I have ...

Ways to emphasize text in a h2 header without affecting other elements

One particular HTML block is causing me some trouble: <h2><span class="numbers">1.1 </span>header text</h2> It's important to note that I did not write this HTML code, so my options for changing it are limited. Howev ...

Obtaining Values from Multiple Textboxes using jQuery in Model-View-Controller

I'm still learning about MVC and I encountered an issue while trying to edit a row and send the edited data to a controller method using jQuery and AJAX. When I click on edit, the specific row transforms into textboxes and the save ActionLink appears ...

Adjusting the position of just a single box in a flexible layout

I have multiple columns set up in a similar way. <div style="display: flex;flex-direction:column"> <main class="main-contents" role="main">TopHeader </main> <div> content A</div> <div> conte ...

What is the best way to present retrieved JSON data from a database in Node.js without using the JSON format?

Here is the code snippet: var http=require("http"); var fs = require("fs"); var express = require("express"); var app = express(); var path = require("path"); var mysql = require('mysql'); var ejs = require("ejs") var bodyParser = require(&apos ...

Steps for adding a user-glyphicon within an img tag

In the given code, I am trying to create a function where if no photo is uploaded, a default bootstrap glyphicon-user image should be displayed. Once a photo is uploaded, it should overwrite the default image. //Please ensure necessary Bootstrap files are ...

Issues with displaying iframes on iOS devices, particularly iPhones

There is a strange issue I am encountering with iframes not displaying on certain phones while working perfectly on others. (They show up fine on all android devices) (However, they do not work on iphone 6 and 7 but surprisingly work on 7 plus, 7S, and a ...

Is it possible to implement a unique style exclusively for my application's components?

Recently, I've been trying to apply a universal style rule to my entire app similar to this: div { width: 100%; } At first, everything seemed to be working perfectly. However, when I began integrating third-party components that have their ow ...

PHP: I am unable to establish a connection with the script or submit form data to mySQL

Seeking assistance with debugging this script. (The * represents confidential information that I am aware of but cannot share) <?php $dbhost = '*********'; $dbuser = '*********'; $dbpass = '*********'; $conn = mysql_conne ...

Displaying file when JQuery dialog is opened

I am utilizing a JQuery dialog to load a partial view within it. $("#WOdialog").dialog({ width: 765, resizable: false, closeOnEscape: true, modal: true, clos ...

A div element appears without any height if there is an image contained within it

I am facing a challenge with a div[div1] that contains other elements. The elements inside have an absolute positioned image, and both div1 and the elements have a float left property without showing any height. Is there a solution to give div1 a height so ...