1

Here i am using framerjs, i am trying to call function which changes the position of the other layers. when i click on layer product_scroller the value of curpage changes and replaced with product_details and function changepos() will be called. but here onclick product_scroller the changepos() is not working for first time.but when i click for second time its working. how to avoid this. i want to call changepos() on just one click.

product_scroller.on(Events.Click,function(){ 
curpage = product_scroller.currentPage 
setInterval(
  changepos(), 1000);
})



function changepos(){
        curpage = product_scroller.currentPage;
        if(curpage == product_details)
        {
          product_description1.y=1630
          product_description2.y=1855
          product_description3.y=2080
          product_description4.y=2305
          footer.y = 2570
          carousel.y = 2570 
        } else if (curpage == product_details2) {  
          product_description1.y=1100
          product_description2.y=1325
          product_description3.y=1550
          product_description4.y=1775
          footer.y = 2030
          carousel.y = 2030 
        } else {
            console.log("no outcome");
        }
}
CJAY
  • 6,989
  • 18
  • 64
  • 106

0 Answers0