Advertisement
Konark

Untitled

Oct 1st, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. var dropdownItemPositionLeft = parseInt( $menuItemDropdown.offset().left ),
  2. windowWidth = parseInt( jQuery( window ).width() );
  3.  
  4. if ( this.elements.$cmsmastersMenuContainer.hasClass( 'cmsmasters_nav_menu_dropdown_position_right' ) ) {
  5. $menuItemDropdown.css( 'left', '100%' );
  6. var dropdownItemPosition = parseInt( $menuItemDropdown.width() ) + parseInt( $menuItemDropdown.offset().left );
  7.  
  8. if ( windowWidth > dropdownItemPosition ) {
  9. $menuItemDropdown.css( {
  10. right: 'auto',
  11. left: '100%',
  12. } );
  13. } else {
  14. $menuItemDropdown.css( {
  15. right: '100%',
  16. left: 'auto',
  17. } );
  18. }
  19. } else {
  20. if ( 0 < dropdownItemPositionLeft ) {
  21. $menuItemDropdown.css( {
  22. left: 'auto',
  23. right: '100%',
  24. } );
  25. } else {
  26. $menuItemDropdown.css( {
  27. left: '100%',
  28. right: 'auto',
  29. } );
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement