locked
onendtransition event in javascript

    Question

  • How to implement onendtransition event in javascript in windows store apps?

    I have a UI element and I need to know when transition is ended.


    • Edited by Ali.Ry Sunday, November 11, 2012 9:16 AM
    Sunday, November 11, 2012 9:13 AM

Answers

All replies

  • // get the element (the one being transitioned or any parent/grandparent all the way to document.body)
    var someElement = document.getElementById('foo'); // or document.querySelector('.foo');
    someElement.addEventListener('endtransition', function(ev) {

    var srcElement = ev.srcElement;

    debugger;

    });

    • Proposed as answer by Cobra Tap Sunday, November 11, 2012 5:48 PM
    Sunday, November 11, 2012 5:47 PM
  • maybe I didn't write my question properly.

    My problem is that there is no "endtransition" event for UI elements in windows store apps.

    I'm looking for any replacement event or method to implement it.

    Sunday, November 11, 2012 5:54 PM
  • Open an HTML app in Visual studio
    Look under references and find Windows Library for JavaScript 1.0
    Open base.js inside it...

    Search for: "function executeElementTransition"

    They do:

    listener.addEventListener(

    "transitionend", onTransitionEnd, false);

    So I don't know what you mean by its not implemented...

    Alternatively you could use setTimeout(function, 300) to run code 300ms from now (not really timed in sync but close enough for most problems)...

    Sunday, November 11, 2012 6:22 PM
  • yes you are right.

    my problem was that I was using "endtransition" but it is "transitionend"

    now it works.

    Thank you


    Sunday, November 11, 2012 6:37 PM