javascript: else if condition not working : <p>The button that I'm working on, when clicked, pans a div to the left.
In the script, the "if" condition works fine but the "if else" condition doesn't.</p>

<p>Did I forgot something to include in the script? </p>

<p>here's my script: </p>

<pre><code>&lt;script&gt;
    function panleft(el){
        var elem = document.getElementById(el);

        if (elem.style.left = "90%"){   
            elem.style.transition = "left 0.3s ease-in 0s";
            elem.style.left = "70%";
            }

        else if (elem.style.left = "70%"){  
            elem.style.transition = "left 0.3s ease-in 0s";
            elem.style.left = "90%"
            }

    }

&lt;/script&gt;
</code></pre>
