after much testing and more testing and more testing,
i realize the codes need to be inside the blue object on drag.

i came up with these codes but it is still not ideal. the problem is it still runs the "detect bottom codes" when it is running the "inside codes". any help is greatly appreciated  ;D
This problem i am facing is due to my inability to code the conditions "detect bottom codes" differently as "inside codes". Any tips? I try to create knowledge by doing, but it is difficult without your help! :D

if (( ox-w/2-oxmin)*(ox+w/2-oxmax)>0&&(oy+h/2-oymin)*(oy+h/2-oymax)<0){ // "detect bottom codes" suggestion by wolfgang method by hwang to detect outside the jaws
oy = oymin-h/2; // force blue object to be fixed just below jaw
}

if ((ox-w/2-oxmin)*(ox+w/2-oxmax)<=0 &&oy+h/2 >= oymin){ // "inside codes"  detect inside jaws
 if ( (ox-w/2-oxmin)<=0) // if exceed into the left jaw
 {
   ox=oxmin+w/2; // force blue object to sit by the side of left jaw
   }
 if ((ox+w/2-oxmax)>=0) // if exceed into the right jaw
 {
   ox=oxmax+w/2; // force blue object to sit by the side of right jaw
   }
   }