Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. var showDetailWindow = function(el, menu) {
  4.    
  5.     // change last elements text and set new element as last element
  6.     parentEl = el;
  7.     //get the position of the placeholder element
  8.     jQuery('.modal-window-box').fadeOut();
  9.     var leftOffset = 570;
  10.     var topOffset = -20;    
  11.     var pos = jQuery(el).offset();    
  12.     var eWidth = jQuery(el).outerWidth() + leftOffset;
  13.     var mWidth = jQuery(menu).outerWidth();
  14.     var left = (pos.left + eWidth - mWidth) + "px";
  15.     var top = topOffset+pos.top + "px";
  16.     //show the menu directly over the placeholder  
  17.     jQuery(menu).css( {
  18.             position: 'absolute',
  19.             zIndex: 5000,
  20.             left: left,
  21.             top: top
  22.     } );
  23.     jQuery(menu).hide().fadeIn();
  24. };
  25.  
  26. function showToggleMoreAttributes(categoryName){
  27.     var modalHtml = jQuery("#modalContent"+categoryName).html();
  28.     window.ModalWindow.draw(categoryName, modalHtml);
  29. }
  30. /*
  31.  * function to remove the floating windows
  32.  * todo: the "if" statement needs to be solved and cased a bit more precise ;)  
  33.  */
  34. var currentAction = afterDocumentReady.addAction();
  35. currentAction.doAfter = function()
  36. {
  37.     // on click somewhere in the dom
  38.     jQuery(document).click(function(e){
  39.         if(e.target.className == "knm-modal-window" || e.target.className == "page" || e.target.className == "category-products"){window.ModalWindow.remove();}
  40.     });
  41.     // on escape key press destroy modal window
  42.     jQuery(document).keyup(function(e) {
  43.           if (e.keyCode == 27) {window.ModalWindow.remove();}   // esc
  44.     });
  45.     window.initBodySize();
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement