I'm a total beginner in coding, so please excuse this simple question.
I have an HTML file with an SVG in it:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
</head>
<body>
<img src="example.svg" width="1000" height="700" >
</body>
</html>
I need the following: A Javascript function which translates the SVG by 100px along the y-axis. How does such a function concretely have to look like?
Remarks: It must be Javascript. The SVG could also be included by the object-tag (instead of img). I need jquery at some other point, that's why it is loaded.
Thank you very much in advance for any help!
EDIT: What I have done so far. The HTML is included as iframe in an other project. The goal is to show a "specific part" of the SVG when the JS is triggered. I tried the following code in the head of the HTML:
$(document).ready(function()
{
window.parent.translation = function()
{
window.scrollTo(0, 100);
}
});
This would solve my problem and works everywhere perfectly fine - except for ipads. Whatever I did I could not scroll or jump to an anchor on ipads. That`s why I want to translate the SVG now (instead of scrolling the page). The effect should be the same.
So I tried to add an ID to the SVG as follows:
<img id="example_svg" src="example.svg" width="1000" height="700" >
And then I replaced the line with "scrollTo" by the following code:
document.getElementById('example_svg').style.setProperty("top", "100px");
But this doesn't work. So that's the point where I need help (alternatively scrollTo would be fine if it worked on ipads - but none of the workarounds I found in the internet worked).