Guest User

Untitled

a guest
Mar 24th, 2018
99
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.  
  3. // X postion get
  4. var viewPortHeight = $(window).height();
  5. var getCurrentPostion = e.clientY;
  6.  
  7. // set automatic position in viewport
  8. console.log(viewPortHeight, getCurrentPostion);
  9.  
  10. // if ((viewPortHeight - selfPostion) < droplistHeight) {
  11. if ((viewPortHeight / 2) < getCurrentPostion) {
  12. console.log('if');
  13. $(this).parent().removeClass('dropdown');
  14. $(this).parent().addClass('dropup');
  15. } else {
  16. console.log('else');
  17. $(this).parent().removeClass('dropup');
  18. $(this).parent().addClass('dropdown');
  19. }
  20.  
  21. });
Add Comment
Please, Sign In to add comment