Guest User

Untitled

a guest
Mar 24th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. $('*[data-toggle="dropdown"]').click(function (e) {
  2. // X postion get
  3. var viewPortHeight = $(window).height();
  4. var getCurrentPostion = e.clientY;
  5.  
  6. // set automatic position in viewport
  7. console.log(viewPortHeight, getCurrentPostion);
  8. // if ((viewPortHeight - selfPostion) < droplistHeight) {
  9. if ((viewPortHeight / 2) < getCurrentPostion) {
  10. console.log('if');
  11. $(this).parent().removeClass('dropdown');
  12. $(this).parent().addClass('dropup');
  13. } else {
  14. console.log('else');
  15. $(this).parent().removeClass('dropup');
  16. $(this).parent().addClass('dropdown');
  17.  
  18. }
  19.  
  20. });
Add Comment
Please, Sign In to add comment