Click here to Skip to main content
15,900,378 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerRe: implement double click event on Div child elements Pin
Steve Holdorf28-May-12 7:14
Steve Holdorf28-May-12 7:14 
QuestionJava Script moveing a picture around the screen Pin
Boaz Yaari26-May-12 5:00
Boaz Yaari26-May-12 5:00 
AnswerRe: Java Script moveing a picture around the screen Pin
Ali Al Omairi(Abu AlHassan)26-May-12 20:57
professionalAli Al Omairi(Abu AlHassan)26-May-12 20:57 
GeneralRe: Java Script moveing a picture around the screen Pin
Boaz Yaari27-May-12 10:43
Boaz Yaari27-May-12 10:43 
GeneralRe: Java Script moveing a picture around the screen Pin
BobJanova28-May-12 23:34
BobJanova28-May-12 23:34 
GeneralRe: Java Script moveing a picture around the screen Pin
Boaz Yaari27-May-12 11:22
Boaz Yaari27-May-12 11:22 
GeneralRe: Java Script moveing a picture around the screen Pin
Ali Al Omairi(Abu AlHassan)28-May-12 0:38
professionalAli Al Omairi(Abu AlHassan)28-May-12 0:38 
AnswerRe: Java Script moveing a picture around the screen Pin
Ali Al Omairi(Abu AlHassan)31-May-12 7:40
professionalAli Al Omairi(Abu AlHassan)31-May-12 7:40 
Sir;
I have wrote some nice code that moves a panel using 4 circle formula
take a look

JavaScript
function DrawArc1(t) {
    var a = (1.0 + t / 2000.0) * Math.PI;
    var x = 50.0 + 50.0 * Math.cos(a);
    var y = - 50.0 * Math.sin(a);

    var panel = document.getElementById('movepanel');
    panel.style.left = x + 'px';
    panel.style.top = y + 'px';
}
function DrawArc2(t) {
    var a = (0.5 + t / 2000.0) * Math.PI;
    var x = 100 + 50 * Math.cos(a);
    var y = 50 - 50 * Math.sin(a);

    var panel = document.getElementById('movepanel');
    panel.style.left = x + 'px';
    panel.style.top = y + 'px';
}
function DrawArc3(t) {
    var a = (t / 2000.0) * Math.PI;
    var x = 50.0 + 50.0 * Math.cos(a);
    var y = 100.0 - 50.0 * Math.sin(a);

    var panel = document.getElementById('movepanel');
    panel.style.left = x + 'px';
    panel.style.top = y + 'px';
}
function DrawArc4(t) {
    var a = (1.5 + t / 2000.0) * Math.PI;
    var x =  50 * Math.cos(a);
    var y = 50 - 50 * Math.sin(a);

    var panel = document.getElementById('movepanel');
    panel.style.left = x + 'px';
    panel.style.top = y + 'px';
}
function move() {

    var t = 0;
    var timeout = setInterval(function() {
        if (t >= 0 && t <= 2000) {
            DrawArc1(t);
        }
        else if (t > 2000 && t <= 4000) {
            DrawArc2(t - 2000);
        }
        else if (t > 400 && t <= 6000) {
            DrawArc3(t - 4000);
        }
        else if (t > 6000 && t <= 8000) {
            DrawArc4(t - 6000);
        }
        else clearInterval(timeout);
        t += 100;
    }, 100);

}


the function move calls DrawArc1, DrowArc2, DrawArc3, DrawArc4 according to time to make a relationship between time and position. i hope you find it useful.

you can also put the formulas and time intervals in an array.
Help people,so poeple can help you.

GeneralRe: Java Script moveing a picture around the screen Pin
enhzflep31-May-12 10:38
enhzflep31-May-12 10:38 
GeneralRe: Java Script moveing a picture around the screen Pin
Ali Al Omairi(Abu AlHassan)1-Jun-12 1:15
professionalAli Al Omairi(Abu AlHassan)1-Jun-12 1:15 
AnswerRe: Java Script moveing a picture around the screen Pin
enhzflep29-May-12 10:41
enhzflep29-May-12 10:41 
QuestionHow to change mouse cursor in jQuery UI resizable plugin? Pin
Tesic Goran25-May-12 0:06
professionalTesic Goran25-May-12 0:06 
AnswerRe: How to change mouse cursor in jQuery UI resizable plugin? Pin
Ali Al Omairi(Abu AlHassan)29-May-12 5:08
professionalAli Al Omairi(Abu AlHassan)29-May-12 5:08 
QuestionA Unique Problem - Ignoring Placing Page on Back Button History Pin
OrangeV24-May-12 5:40
OrangeV24-May-12 5:40 
AnswerRe: A Unique Problem - Ignoring Placing Page on Back Button History Pin
Sandeep Mewara24-May-12 9:02
mveSandeep Mewara24-May-12 9:02 
QuestionHow to make the text box draggable using jQuery? Pin
Tesic Goran23-May-12 8:45
professionalTesic Goran23-May-12 8:45 
AnswerRe: How to make the text box draggable using jQuery? Pin
Vitaly Tomilov24-May-12 16:13
Vitaly Tomilov24-May-12 16:13 
AnswerRe: How to make the text box draggable using jQuery? Pin
ZurdoDev25-May-12 8:47
professionalZurdoDev25-May-12 8:47 
Questionfinding a substring match at the beginng of a of another string. Pin
Steve Holdorf22-May-12 7:16
Steve Holdorf22-May-12 7:16 
AnswerRe: finding a substring match at the beginng of a of another string. Pin
Vitaly Tomilov22-May-12 8:51
Vitaly Tomilov22-May-12 8:51 
AnswerRe: finding a substring match at the beginng of a of another string. Pin
scottgp22-May-12 9:25
professionalscottgp22-May-12 9:25 
QuestionSimple autocomplete textbox control problem Pin
Steve Holdorf20-May-12 11:10
Steve Holdorf20-May-12 11:10 
AnswerRe: Simple autocomplete textbox control problem Pin
Vitaly Tomilov20-May-12 11:27
Vitaly Tomilov20-May-12 11:27 
QuestionHow to read Doc or Pdf file using javascript or jquery Pin
priya014319-May-12 2:03
priya014319-May-12 2:03 
AnswerRe: How to read Doc or Pdf file using javascript or jquery Pin
frostcox19-May-12 21:24
frostcox19-May-12 21:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.