dcsimg
www.webdeveloper.com
Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18

Thread: dont make function within a loop

  1. #16
    Join Date
    Sep 2016
    Posts
    7
    thanks clockout but i am really a newbie in javascript
    which will me the code to remplace this for mouse enter and leave on my 2 elements?
    thanks

    document.addEventListener("DOMContentLoaded", function() {
    var elem = document.querySelectorAll(".BoItE, .StOp");
    var j;
    function mOuSeE() {
    window.Am = 1;
    }
    function mOuSeL() {
    window.Am = 0;
    }
    for (j = 0; j < elem.length; j+=1) {
    elem[j].addEventListener("mouseenter", mOuSeE);
    elem[j].addEventListener("mouseleave", mOuSeL);

    }
    });

  2. #17
    Join Date
    Jun 2009
    Location
    Jacksonville, FL U.S.A.
    Posts
    28
    Here's another JSFiddle.

  3. #18
    Join Date
    Sep 2016
    Posts
    7
    thanks clock out

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles