Dynamic SVG map with responsive design

Happy Holidays!

I am working on creating a responsive clickable map but struggling to keep the positions of the SVG images stable. You can check out my progress here:

I'm at a loss for how to fix this issue. The overlay images seem to move around and lose their intended position when the window is resized.

Does anyone have any suggestions or solutions? Thanks, Anka

Answer №1

It seems that your inquiry pertains to a modification I made on the gelaende div by setting its position to relative.

.gelaende {
        position: relative;
        width: 100%;
        float: left;
 }

Answer №2

Happy Holidays! :) The key to achieving this is by assigning [position : "relative"] to the main parent div, which in this case is labeled as (.container):

<div class="container">
<div id="responsiveTabs" class="r-tabs">
<ul id="tabs" class="r-tabs-nav"> 

...

& make sure to specify [position : "absolute"] for each individual image that you wish to place on top of it. An example of this can be seen below:

#example-image {
 width: 12vw;
 position: absolute;
 height: auto;
 top: 10vw;
 left: 0;
}

It's important to adjust the top and left positions accordingly for each image.

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

Use JavaScript Ajax to call a PHP function and retrieve database data

I am attempting to invoke a PHP function using Ajax. Below is the JavaScript code present in my HTML file: <script type="text/javascript"> function ajax(){ $.ajax({ type:"POST", url: "SQLCommunication.php", ...

Contrast between pre-tag in HTML and white-space: pre newline exclusion

I originally thought that the pre(html tag) would act just like 'white-space:pre'. However, it turns out that it does not behave in the same way. <pre> aaa bbb </pre> <p style="white-space:pre;"> aaa bbb </p> The <pr ...

Add a CSS class to the main document via an iframe

Is there a simple method to apply a CSS class that is specifically defined in the head of an iframe to an element located in the main document? Can this be done without having to resort to using JavaScript to copy the class from the iframe's head to ...

The width of Highcharts items is not reaching 100% when displayed in a carousel

I'm currently using dynamic highcharts graphs within my bootstrap carousel. Here is a snippet of my carousel setup: <div class="carousel"> <div class="carousel-inner"> <div id="item"> <div id="container1" data-h ...

Aligning jQuery Mobile Buttons in a List Divider

Seeking assistance with aligning buttons within a list divider in a jQuery mobile app. Take a look at this link to a jsFiddle demonstration I created where the button appears next to the text. Is there a way to align the button to the right without causing ...

Showing nested div elements in a single row

I'm currently dealing with a react component that generates nested divs. My goal is to make sure all the divs are displayed on the same line, but the catch is I can only apply styles to the outermost container div. Is there a way to achieve this witho ...

What is the best way to iterate through only the selected checkboxes to calculate their

I am in need of calculating the selected checkboxes only within a table field (harga_obat*jumlah) Below is my foreach data: @foreach ($obat as $o) <tr> <td> <input id="check" type="checkbox" name="select[]" value="{{ $o->nam ...

What is the best way to retrieve the input value using jQuery?

I am using a serializer to pass json values into this input field. How can I access the dynamic values? Currently, it is only returning "[" instead of the json values. <input id="jsonValue" type="hidden" value="<%=sb.ToString%>"/> $('#j ...

Steps for adjusting the margin of a section using the p tag

Newbie CSS inquiry here... Here's what I currently have in my stylesheet: #topheader { position: absolute; width: 100%; height: 100px; background-color: #D1E6DA; font-size: 200%; } I want to include the following: p { margi ...

Breaking the website with an HTML comment

Upon clicking a link to another page, I encountered the error message "Failed to execute 'insertBefore' on 'Node." Here is the code snippet that was causing the issue: <template name="reminderPage"> <a href="/newRemind">New! ...

Sending a parameter to the window.onload callback function

Is there a way to pass parameters from ModelAndView to a window.onload function in JavaScript within an HTML file? Here is an example of how it can be done: @RequestMapping(value = "/admin/printtext") public ModelAndView printtext() { ModelAndView mo ...

using localStorage to store multiple keys

My code attempts to generate multiple keys (user_0,user_1,user_3...) for the record(username,password,email). Even though I'm getting an alert saying "The data was saved," nothing is actually being stored in the local storage. Can someone help me figu ...

Is it possible to dynamically set the body id in React?

I'm currently working on implementing a dark mode feature in my app. The plan is to insert the following code into the root element: <div id="dark"> Afterwards, add the following CSS: #dark { background-color: #1A1A2E; } Subseq ...

What is the best way to close an ajax page within the main page using a button?

I am dealing with a situation where I have 2 pages. The first page contains a div called 'ajaxicall', which loads another page inside it. The challenge I am facing is figuring out how to close the second page when I click on the "close" button w ...

Retrieve the updated file name from the mini file upload form

I have implemented the Mini AJAX Upload Form from this tutorial to upload files to a server. I made modifications to add a timestamp at the end of the file name. How can I return the updated file name (with the timestamp) back to the client for future refe ...

Troubleshooting encoding problems when storing HTML in Mongodb

As I develop a web crawler, my next step is to store the extracted html into my MongoDB database. Here's what I have so far(using pymongo): c=urllib2.urlopen(myUrl) html=c.read() db.urls.insert( { ...

The property '_renderItem' cannot be defined as undefined

Seeking assistance with my code... Could someone please help? $(document).ready(function() { //$('#search input[name="filter_name"]').attr("x-webkit-speech", "x-webkit-speech") $('#search input[name="input-search-menu"]').autocompl ...

Steps for placing the table within the box

I am working on a website to enhance my CSS skills using templates. Currently, I am creating a table with 8 attributes. I am seeking advice on how to keep the table within the box borders without overflowing. I attempted to use overflow, but I believe I m ...

Adjust the size of the image to fit within the div container following

<div id="homePage" style="position: relative; margin: 0px; width: 320px; height: 420px;"> <img id="userImg" src="images/5.jpg" width="100%" height="100%" onclick="imageClick()" style=" z-index: -1; margin: 0 ...

Issues with plugins in Rails 4 are causing functionality to not be operating

I recently installed a template and encountered an issue with some of the JavaScript functionality. However, upon checking the compiled list of JavaScript files, I can see that all the files have loaded successfully and the CSS includes all the necessary f ...