Using scale transformations to animate SVG group elements

I am currently experimenting with an SVG example where I hover over specific elements to expand or scale them. However, I seem to have made a mistake somewhere or missed something important. Can someone offer me assistance?

View the demo on JSFiddle here - http://jsfiddle.net/hNrwE/. (Since I'm unsure how to upload the SVG directly to Fiddle, I've included the SVG code here as well)

<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script>
$(function(){

    $("#stage").load('flowchart3.svg',function(response){

        $(this).addClass("svgLoaded");

        if(!response){
            // Error loading SVG!
            // Make sure you are running this on a web server or localhost!
        }

    });
});
</script>
<style>
       <!-- CSS styles go here -->
</style>
<div class="cbody-full">
    <div class="container">
        <div id="benefits">
            <div class="info">
                <div id="stage"> <!-- Fallback Text Content can go here --> </div>
            </div>
        </div>
    </div>
</div>

XML/SVG Code:

<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="timeline" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
     width="960px" height="560px" viewBox="0 0 960 560" enable-background="new 0 0 960 560" xml:space="preserve">
   <!-- SVG content goes here -->
</svg>

Answer №1

It seems that the issue lies in the incorrect Ids used in the selectors and a slight misalignment in the transition effect. However, there may be some misunderstanding on my part regarding your intentions...

For instance, focusing solely on the bottom yellow circle, I have made the following changes...

#yellow2badge:hover [id$="yellow2circle"] {
/*transform*/
-webkit-transform:scale(2, 2);
   -moz-transform:scale(2, 2);
    -ms-transform:scale(2, 2);
     -o-transform:scale(2, 2);
        transform:scale(2, 2);  
}
#yellow2badge:hover [id$="circletext"]{
/*transform*/
-webkit-transform:scale(0);
   -moz-transform:scale(0);
    -ms-transform:scale(0);
     -o-transform:scale(0);
        transform:scale(0);
}
[id$=badge], [id$=circletext], [id$=details],[id$=circle] {
/*transition*/
-webkit-transition:-webkit-transform 0.25s ease-in-out;
   -moz-transition:-moz-transform 0.25s ease-in-out;
     -o-transition:-o-transform 0.25s ease-in-out;
        transition:transform 0.25s ease-in-out;
}

Please note that I have included [id$=circle] and adjusted -webkit-transition to -webkit-transition:-webkit-transform. You can see a test example at , just hover over the bottom circle.

I haven't addressed all elements (particularly the text), and it may require further adjustments for compatibility with other browsers. Nevertheless, I believe this should set you in the right direction.

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

Having trouble rendering JSON encoded data in a JqPlot Chart within a PHP script

I've spent the past few days scouring through Stack Overflow and various other websites, but I haven't been able to find a solution to my specific issue. Even the book 'Create Web Charts with JqPlot' by Fabio Nelli didn't provide t ...

Show a picture upon hovering the button

Welcome to my website. My goal: Show an image when a user hovers over the links. I must be making some silly error, but I can't pinpoint it. This is what I've attempted so far: HTML <ul class="nm"> <li><a href="#">Cork& ...

Discovering the name of an object property by locating its corresponding id

I am working with a basic JSON data structure where I need to retrieve the name from an object by comparing its ID. For example, if I have the number 2, I need to check if it matches any object's ID. If the ID is equal to 2, then I must fetch the corr ...

Looking for a list that you can edit with CSS styling?

I'm struggling to create a flexible list that can be easily modified. My goal is to have an ordered list with unique labels such as 1,2,3,4,5,6,7,8,9,0,A,B,!,# Although I've managed to number the list items, I am stuck on adding the extra label ...

Facing issues with React JS and Material UI? If you're encountering problems where 'this.props' is

After running the code provided below, I anticipated that the styles would be injected within props. However, I consistently encounter undefined props. No props are being supplied to this component. const customStyles = theme => ({ root: { & ...

Filtering elements using two dropdown lists

In my list, each li element has data-name and data-body attributes. I want to display only the li elements that match the selected values. The first select option is for selecting the car name, while the second select option is for selecting the car body. ...

Storing the selected value from a dropdown box in PHP

Can anyone help me with echoing the $row['price'] based on the user's GPU selection? Your input is greatly appreciated! #adding more content to meet word count requirements. <div id="content"> <table border="1" style="width: ...

Blurry text and icons in Bootstrap 3

Does anyone else notice a strange display issue with Bootstrap 3 fonts and glyphicons? It seems like the bitmaps and fonts are appearing blurry on desktops when using Firefox and Chrome, but everything looks fine on mobile devices. I've attached an ex ...

Using the methods res.render() and res.redirect() in Express.js

I'm facing a challenge with a route in my express app, where I need to achieve the following: Retrieve data from an external source (successful) Show an HTML page with socket.io listening for messages (successful) Conduct lengthy calculations Send a ...

Data is stored in Django Fullcalendar without saving it in the database, instead a primary key is generated

I am currently facing an issue where the actual data is not being saved in the database. Whenever I click the register button after inputting the data, an empty data entry gets saved and a primary key is created. There are no error messages being displayed ...

Extract the raw text content from nested elements

Working with highlight.js to include a custom CSS code, however, this library automatically adds span tags around the desired text For example: <pre> <code class="language-css hljs" contenteditable="true" id="css-code&quo ...

Trouble with retrieving data from localStorage

On my webpage, I have set up multiple input fields where users can enter data. When they click a button, the data from these inputs is stored inside <span>...</span> elements (the intention being that the text remains visible in these <span& ...

Is there a way to shift this div to the bottom and incorporate some quirky pop-up squares?

I am struggling to figure out how to move this div to the bottom. Additionally, I want to create temporary pop-up squares (simple divs) in random directions that will disappear after 50ms. My attempt to float this box to the bottom did not yield the desir ...

Is there a way for me to modify this carousel so that it only stops when a user hovers over one of the boxes?

I am currently working to modify some existing code to fit my website concept. One aspect I am struggling with is how to make the 'pause' function activate only when a user hovers over one of the li items, preventing the carousel from looping end ...

What is the most efficient way to transfer a value from the main application file to a router file using the express framework

Currently, I am developing an Express application with multiple routes. To ensure modularity, each route will have its own file stored in a dedicated routes folder. One challenge I encountered is sharing a common value across all routes. Specifically, I n ...

I am experiencing issues with the rendering of my q-btn elements in Quasar and they are

I recently started using Quasar and encountered an issue with my q-btn component buttons displaying white backgrounds at random, despite having added a background-color in the external stylesheets. Here are some examples of this perplexing problem: The e ...

Loading necessary CSS when needed in React JS

I am currently in the process of converting a bootstrap template to react framework. My question is, is there a way for me to load stylesheets on demand? For instance, if I have 2 components and I import the same stylesheet separately in both components, ...

Strategies for avoiding asynchronous behavior in AJAX with JQuery

My questions are best explained through code rather than words. Take a look at the snippet below and try to understand it: $('#all').on('change', function(){ //ONCHANGE RADIOBUTTON, THERE ARE #bdo, #cash also. $.ajax({ type:"GET", ...

Tips for automatically disabling cloudzoom based on image width

I'm currently utilizing cloudzoom with the given markup: <div id="container"> <img id="main-image" class="cloudzoom" src="/img/image1.jpg" data-cloudzoom="variableMagnification: false, zoomOffsetX: 0, zoomPosition: 'inside', zoom ...

Is there a way to ensure that a "catch all other" route in the Vue Router will also capture the URL if a portion of it matches a predefined route?

After following the suggestion to implement a catch all route from this article, I realized that it does not capture URLs that partially match a defined route. routes: [ { path: "/album/:album", name: "album", component: Album, } ...