Beiträge von Beginner2002

    So springt er bis ans untere Ende der Seite. Um den Kreis zu sehen, muss man noch nach rechts scrollen:


    <html>

    <head>

    <script>

    function Los() {

    document.getElementById('Kreis').scrollIntoView();

    }

    </script>

    </head>


    <body>


    <input type="button" value="Zeige" onclick="Los();" /><br><br>

    <svg id="Markierung" width="3500" height="3500"><circle id="Kreis" cx="3100" cy="2900" r="40" stroke="green" stroke-width="4" fill="yellow" /></svg>

    </body>

    </html>


    Irgendjemand eine Idee??

    und so geht's auch nicht. Er springt nur ein mini mini Stück nach rechts ohne den kreis zu sehen



    <head>

    <script>

    function Los() {

    document.getElementById('kreis').scrollIntoView();

    }

    </script>


    </head>

    <body>


    <input type="button" value="Zeige" onclick="Los();" /><br><br>


    <svg id="kreis" width="1500" height="1500">

    <circle cx="1100" cy="900" r="40" stroke="green" stroke-width="4" fill="yellow" />

    </svg>

    </body>

    </html>




    Es geht auch nicht mit der Funktion unter dem svg.

    so geht's nicht:


    <head>

    <style>

    body{

    height:1500px;

    }

    </style>

    </head>

    <body>

    <a href="javascript:void(0)" onclick="document.getElementById('kreis').scrollIntoView();">ZumKreisScrollen</a>


    <svg width="1204" height="1300"><circle id="kreis" cx="380" cy="310" r="20" stroke-width="5" stroke="red" fill="red" fill-opacity="0.5"/></svg>

    </body>

    </html>

    So geht's erstmal. Ich versuche es gleich mit einem button.


    <head>

    <style>

    body{

    height:1200px;

    }

    #kreis{

    width:100px;

    height:100px;

    background:red;

    border-radius:50%;

    margin-top:1000px;

    }</style></head><body>

    <a href="javascript:void(0)" onclick="document.getElementById('kreis').scrollIntoView();">ZumBallScrollen</a>


    <div id="kreis"></div>


    </body></html>

    Es funktioniert weder mit der Funktion Los() hinter dem div-Block im Body noch mit Los() im head. Die Karte und die Markierung werden gezeigt, aber es wird nicht dorthin gescrollt.

    <html>

    <head>


    <style type="text/css">

    .under {

    position: absolute;

    left: 0px;

    top: 400px;

    z-index: -1;

    }


    .over {

    position: absolute;

    left: 0px;

    top: 400px;

    z-index: -1;

    opacity: 1;

    }

    </style>



    </head>

    <body>


    <div align="center">

    <img class="img-a" src="images\Logo.png" width="230" height="138"><br><br>

    <input type="button" value="Zeige" onclick="Los();" /><br><br>

    <img id="Karte" src="images\Karte.svg" width="1204" height="1300" class="under" style="visibility:hidden" />

    <svg id="Markierung" width="1204" height="1300" class="over" style="visibility:hidden"> <circle id="Kreis" cx="380" cy="310" r="20" stroke-width="5" stroke="red" fill="red" fill-opacity="0.5" /></svg>

    </div>


    <script>

    function Los() {

    document.getElementById("Karte").style.visibility = "visible";

    document.getElementById("Markierung").style.visibility = "visible";

    document.getElementById("kreis").scrollIntoView()

    }


    </script>

    </body>

    </html>

    hmmm habe es jetzt so und es funktioniert nicht :(



    <html>

    <head>

    <script>

    function myFunction() {

    document.getElementById("kreis").scrollIntoView()

    }

    </script>

    </head>

    <body>


    <h1>My first SVG</h1>

    <input type="button" value="KLICK" onclick="myFunction();"/><br><br>

    <svg id="kreis" width="100" height="100">

    <circle cx="500" cy="1500" r="40" stroke="green" stroke-width="4" fill="yellow" />

    </svg>


    </body>

    </html>

    Das mit dem window.scrollTo(x,y) funktioniert bestens Basti!!! Sehr gut!!

    Klappt das auch mit meinem svg-circle?

    Der hat eine eigene id=“Kreis“.

    Dann so: window.scrollTo(“Kreis“).

    Ich kann’s erst morgen weiter probieren.