The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Need your help guys (simple problem), Accelerometer ball demo
Saul
post Oct 25 2017, 04:01 AM
Post #1





Group: Members
Posts: 1
Joined: 25-October 17
Member No.: 26,517



Hi everybody

Iam very new to HTML (proper Noob) so your knowledge would be much appreciated
anyway let me explain

Iam creating a site for my iphone
its very simple

1 image
1 javascript

Using the JavaScript from this Accelerometer ball demo, (as you tilt your phone the ball moves around the screen) Simple ye.

I need to restrict the ball to only move in the Red area, & i have no idea how to do this.
IPB Image

this is my html file
Attached File  index.html ( 2.36k ) Number of downloads: 838


Thanks guys

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Oct 25 2017, 08:11 AM
Post #2


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



Try setting h in function intit() to something else than the window height.


QUOTE
CODE
function init()
{
    ball = document.getElementById("ball");
     w = window.innerWidth;
     h = window.innerHeight;
...
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th March 2024 - 10:39 AM