0

i have small application in Famo.us

I have following code..

draggable.on('update',function(data){
        var pos =data.position;
        var t = pos.split(",");
});

In above code, data.position return result in x,y format, i just want to check x value whether it is greater than 0 or not. For that i have used split function. but it doesn't work..

How to use Split and substring functions in Famp.us

BenMorel
  • 34,448
  • 50
  • 182
  • 322
ghanshyam.mirani
  • 3,075
  • 11
  • 45
  • 85

1 Answers1

1

The problem is that data.position returns an array and not a string..

You could do the following to get the x position.. Hope it helps!

draggable.on('update',function(data){
    var pos = data.position;
    var x = pos[0];
    var y = pos[1];
});
johntraver
  • 3,612
  • 18
  • 17