0

Since two days the script below is not working anymore in the Ripple Emulator of Visual Studio 2015. Cordova 3.0 + 2.0. My picture stops on the y axis after 252px. x axis is working.

It is still running successfully in Chrome and with the Ripple-Extension both by using the file url.

I want the image to move endless with 225 degrees from top position to the left bottom.

2 pictures to explain it:

Not working: localhost

Working: url

Both times I am using the same code. Cache issue?

<html>
<head>
<title>Image moving</title>
<style>
    #Ball {
        position: absolute; 
        left: 500px; 
        top: 10px; 
        }
</style>
</head>
<body >
<script>
window.onload = function () {
    startBall();
};

function move(xstep, ystep) {

    var y = document.getElementById('Ball').offsetTop;
    var x = document.getElementById('Ball').offsetLeft;

    y = y + ystep;
    x = x + xstep;

    document.getElementById('Ball').style.top = y + "px"; // vertical movment
    document.getElementById('Ball').style.left = x + "px"; // horizontal movment
}

function startBall() {

    move(-1, 1);

    var y = document.getElementById('Ball').offsetTop;
    var x = document.getElementById('Ball').offsetLeft;

    document.getElementById("msg").innerHTML = "X: " + x + " Y: " + y;
    my_time = setTimeout('startBall()', 10);
}
</script>
<img src='images/Ball.jpg' id='Ball'>
<div id='msg'></div>
</body>
</html>
Chris
  • 1
  • 1
  • Hi and welcome to stackoverflow. Can you clarify exactly what you want your code to do and what is wrong? Also, please minimize your example to the smallest viable example. See http://stackoverflow.com/help/mcve – dovetalk Mar 20 '16 at 22:15
  • Hi dovetalk, the html is already condensed. I needed css + script to make this issue complete. I added 2 pictures and made my goal bold now. I guess this issue is about infrastructure not about the code itself, that is why I did not put it in jsfiddle. – Chris Mar 21 '16 at 00:08

1 Answers1

0

Solved it.

It was my js cache in Chrome. Could not solve it with F5 but I could solve it by disabling the cache: Disabling Chrome cache for website development

Community
  • 1
  • 1
Chris
  • 1
  • 1