logo
down
shadow

Using JavaScript to change CSS properties of SVG circles for all circles that was not clicked


Using JavaScript to change CSS properties of SVG circles for all circles that was not clicked

Content Index :

Using JavaScript to change CSS properties of SVG circles for all circles that was not clicked
Tag : javascript , By : LinnheCreative
Date : January 12 2021, 01:40 AM

Any of those help I now contain a list that contains several li and each li contain a circle I would like a way to efficiently and not hardcode a way to change the class of each circle that was not clicked to disabled and for the circle that was clicked to active. , Probably you don't need to set 'disabled' (as in sippet below).
let circles = [...document.querySelectorAll('circle')];

circles.forEach(c => c.onclick = e=> {
  circles.forEach(cc=> cc.classList.remove('active'));
  e.target.classList.add('active');
});
let circles = [...document.querySelectorAll('circle')];

circles.forEach(c => c.onclick = e=> {
  circles.forEach(cc=> cc.classList.remove('active'));
  e.target.classList.add('active');
});
svg { height: 50px; width: 50px; }
.circ {
  stroke: black;
  stroke-width: 3;
  fill: gray;
  cursor: pointer;
}

.active { fill: red; }
<ul>
   <li>
     <svg>
         <circle cx="25" cy="25" r="20" class="circ active"  />       
         <span> Text </span>
     </svg>
   </li>
   
   <li>
     <svg>
         <circle cx="25" cy="25" r="20" class="circ"  />       
         <span> Text </span>
     </svg>
   </li>
   
   <li>
     <svg>
         <circle cx="25" cy="25" r="20" class="circ"  />       
         <span> Text </span>
     </svg>
   </li>
</ul>

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

css circles using border radius need to change the color of intersected section of circles


Tag : css , By : Tom Berthon
Date : March 29 2020, 07:55 AM
may help you . A bit simpler version: Fiddle
<div class='circle-holder'>
    <div id='circle-1' class='circle'></div>
    <div id='circle-2' class='circle'></div>
    <div id='circle-3' class='circle'></div>
    <div id='circle-4' class='circle'></div>
    <div id='circle-5' class='circle'></div>
</div>
.circle {
    width: 201px;
    height: 201px;
    border-radius: 101px;
    float: left;
    position: relative;
    overflow: hidden;
    margin-right: -30px;
}

.circle + .circle::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: -170px;
    background: #fff;
    border-radius: 101px;
}

How to create a layout which has circles and inside the circles are hidden numbers once clicked you view the number. See


Tag : java , By : mlapida
Date : March 29 2020, 07:55 AM
Does that help circle.xml

Android: When drawing circles on SurfaceView all other circles change positions


Tag : java , By : Alex S
Date : March 29 2020, 07:55 AM
it should still fix some issue You're not clearing the Canvas every frame, which is required by lockCanvas(). You're seeing things "move" because the surface is double- or triple-buffered, so you're seeing the previous contents of alternate buffers.
There's no mechanism that would cause drawn pixels to swap X/Y coordinates. Make a series of touches in a horizontal line, left to right, and you should see alternating circles light up on each touch.

P5js. Sliding matrix of circles, can't generate or fill new row of circles in 2D array


Tag : javascript , By : Diego
Date : March 29 2020, 07:55 AM
I think the issue was by ths following ,
I want it that it generates a new row at the beginning every time, so that it never repeats itself...
slide(amt) {
     if( ypos >  linesAmt * lineSpacing ) {
         ypos = lineSpacing
         maxRadius = Math.random()*9 // <-- new random radius for the circle 
     }
     ypos += amt
}

how to make my code identify the difference between 2 circles (2 circles one filled with white and one with black) using


Tag : python , By : baylisscg
Date : March 29 2020, 07:55 AM
Hope that helps Well, If all you want is Edge Detection in an image, then you can try using Sobel Operator or its equivalents.
from PIL import Image, ImageFilter

image = Image.open(r"Circle.png").convert("RGB")
image = image.filter(ImageFilter.FIND_EDGES)
image.save(r"ED_Circle.png")
Related Posts Related QUESTIONS :
  • How to make button open a link in new tab in JavaScript?
  • Find range from the javascript object
  • How can I use my jQuery code as JavaScript?
  • How to show 5 images in a 2 row slider with bxslider
  • How to convert stream into variables in typescript
  • Three.js custom shader error on Chrome GL_INVALID_OPERATION: Active draw buffers with missing fragment shader outputs
  • My JavaScript doesn't work. How can I solve this problem?
  • Why is this async function is running synchronously?
  • Get updated variable from within react hook before return
  • I want to show all image preview but whenever I upload a new one the old one is gone
  • Would I be able to give access to specific electron APIs safely?
  • Why several clicks fire for each instance of a Class?
  • cant grab value from div using attr()
  • Make web service not accessible by browser?
  • Select DOM elements within template
  • How to customize angular ui-grid row background color?
  • Binding data in two respective $scope in AngularJS, how?
  • react put some props after import class
  • Variable is distributed among same components
  • switch class in jQuery/JavaScript for active/inactive state
  • How To Track Outbound Clicks Using Javascript
  • How to get total seconds elapsed since the beginning of the month?
  • Protractor: Stale element reference at "browser.wait(EC.visibilityOf(confDial), FIFTY_SECONDS);"
  • Access to an array inside an object
  • Reseting an JavaScript Interval with different value?
  • Learning Angular for the first time - version 2 or 4?
  • Rendering RSS feed (XML) in React with jquery, why do object values parsed from the feed seem empty?
  • Node.js xml2js http.request tag matching
  • applying texture to custom plane geometry in Threejs
  • How do I pass an Event as a function parameter in HTML written inside JavaScript variable?
  • Interface of object parameter with default value and default property
  • Does using try / catch rather than `.catch` observable operator with XHR requests reduce performance?
  • In IE11 background colors not working on printing
  • TypeScript interface signature "(): string"
  • Is synchronous XMLHttpRequest supported in Internet Explorer 10 and 11?
  • Axios function not returning any values with js
  • How to use firestore TIMESTAMP to create time-stamp in JavaScript
  • Instantiate subclass without constructing
  • Outputing a created object in javascript to a server side JSON file
  • Transition the numeric labels in a bar chart
  • createBottomTabNavigator: hide just one tab from the tabBar
  • iife vs simple statement behavior with document.title
  • showDialogPopup Refresh Page after Click
  • Child component does not set the initial value passed from the parent: ReactJS
  • Nodejs javascript added to button not responding
  • Trying to define a promise.all
  • Python GEE to extract featurecollection timeseries from Landsat imageries
  • How to write negative binary number?
  • Unable to set property of individual object
  • Why Named Function Expression itself cannot assign Name to another Value?
  • How to reset scroll position on single page pagination
  • How to scroll to bottom of page, when a new message is sent - Socket.io
  • How to reconstruct audio blob from a base64 encoded String?
  • How to calculate numbers within an array of objects
  • Is there value in propTypeing repeat required properties at every level of nested components?
  • Call function if variable does not exist in a filter
  • localStorage value doesn't get updated automatically
  • React not updating state with setState correctly inside promises
  • Direct native JavaScript or jQuery method to get containing block of an element
  • Dynamic JSON object to Html Table
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com