May be this is small question. But I couldn't found reason for this. I made a script to change a position of div by dragging it. the code is working fine with chrome browser. but when I trying to test it on Firefox it is not working.
var h = window.innerHeight|| document.documentElement.clientHeight || document.body.clientHeight;
        window.onload = function () {
// ------------------lock the div with mouse pointer--------------
// variable dragged is for identified that you are click on the button or not
var dragged = false,
y = 0,pointerDis = 0,
boxElement = document.getElementById('drag'),
drgElement = document.getElementById('titl');
            if (boxElement) {
// -----------------check whether the title div is holding by the mouse to lock it with mouse-------
 drgElement.addEventListener('mousedown', function() {
     dragged = true;
        pointerDis = event.clientY -  parseInt(window.getComputedStyle(boxElement, null).getPropertyValue("top"));
});
//------------------check whether the title div is released to drop the div-------------------------
 document.addEventListener('mouseup', function() {
 dragged = false;
});
    document.addEventListener('mousemove', function () {
        y = event.clientY;
     if(dragged == true)
     {
            y = y -pointerDis;
            if(y<0)
            {
                y = 0;
            }
            else if(y > window.innerHeight - boxElement.offsetHeight)
            {
                y = window.innerHeight - boxElement.offsetHeight;
            }
      boxElement.style.top = y + 'px';
     }
    });
 }
};.drg {
   position: absolute;
   top:0;
   right: 0;
   background: red;
   border-top-left-radius: 45px;
   border-bottom-left-radius: 45px;
  }
  #titl{
   background: blue;
   width: 50px;
   text-align: center;
   color: white;
   font-size: 30px;
   border-top-left-radius: 10px;
  }
  #det{
   background: #f9c500;
   width: 50px;
   border-bottom-left-radius: 10px;
   text-align: center;
  }<!DOCTYPE html>
<html>
<head>
 <title>test 4</title>
</head>
<body>
<div class = "drg" id="drag">
 <div id="titl" unselectable="on" onselectstart="return false;">....</div>
 <div id="det">this is the details menu</div>
</div>
</body>
</html>You can drag it through Y axis by click and drag from blue div. I don't know the reason or I couldn't find a way to fix this work on Firefox. Please help me!
 
    