Witam,
Od kilku dni walcze z zamianą .hover na .click niestety bez skutku.
buduję sklep na prestashop i chce edytować moduł menu który aktywuje się po najechaniu chce zmienić na kliknięcie i tu tkwi problem wszystkie zmiany są ignorowane i zaczyna brać dane (Bóg jeden wie skąd) i tu pytanie jak poprawnie to zrobić.

Plik js
  1.  
  2. $(document).ready(function(){
  3. $("#pt_menu_link ul li").each(function(){
  4. var url = document.URL;
  5. $("#pt_menu_link ul li a").removeClass("act");
  6. $('#pt_menu_link ul li a[href="'+url+'"]').addClass('act');
  7. });
  8.  
  9. $('.pt_menu_no_child').hover(function(){
  10. $(this).addClass("active");
  11. },function(){
  12. $(this).removeClass("active");
  13. })
  14.  
  15. $('.pt_menu').hover(function(){
  16. if($(this).attr("id") != "pt_menu_link"){
  17. $(this).addClass("active");
  18. }
  19. },function(){
  20. $(this).removeClass("active");
  21. })
  22.  
  23. $('.pt_menu').hover(function(){
  24. /*show popup to calculate*/
  25. $(this).find('.popup').css('display','inline-block');
  26.  
  27. /* get total padding + border + margin of the popup */
  28. var extraWidth = 0
  29. var wrapWidthPopup = $(this).find('.popup').outerWidth(true); /*include padding + margin + border*/
  30. var actualWidthPopup = $(this).find('.popup').width(); /*no padding, margin, border*/
  31. extraWidth = wrapWidthPopup - actualWidthPopup;
  32.  
  33. /* calculate new width of the popup*/
  34. var widthblock1 = $(this).find('.popup .block1').outerWidth(true);
  35. var widthblock2 = $(this).find('.popup .block2').outerWidth(true);
  36. var new_width_popup = 0;
  37. if(widthblock1 && !widthblock2){
  38. new_width_popup = widthblock1;
  39. }
  40. if(!widthblock1 && widthblock2){
  41. new_width_popup = widthblock2;
  42. }
  43. if(widthblock1 && widthblock2){
  44. if(widthblock1 >= widthblock2){
  45. new_width_popup = widthblock1;
  46. }
  47. if(widthblock1 < widthblock2){
  48. new_width_popup = widthblock2;
  49. }
  50. }
  51. var new_outer_width_popup = new_width_popup + extraWidth;
  52.  
  53. /*define top and left of the popup*/
  54. var wraper = $('.pt_custommenu');
  55. var wWraper = wraper.outerWidth();
  56. var posWraper = wraper.offset();
  57. var pos = $(this).offset();
  58.  
  59. var xTop = pos.top - posWraper.top + CUSTOMMENU_POPUP_TOP_OFFSET;
  60. var xLeft = pos.left - posWraper.left;
  61. if ((xLeft + new_outer_width_popup) > wWraper) xLeft = wWraper - new_outer_width_popup;
  62.  
  63. $(this).find('.popup').css('top',xTop);
  64. $(this).find('.popup').css('left',xLeft);
  65.  
  66. /*set new width popup*/
  67. $(this).find('.popup').css('width',new_width_popup);
  68. $(this).find('.popup .block1').css('width',new_width_popup);
  69.  
  70. /*return popup display none*/
  71. $(this).find('.popup').css('display','none');
  72.  
  73. /*show hide popup*/
  74. if(CUSTOMMENU_POPUP_EFFECT == 0) $(this).find('.popup').stop(true,true).slideDown('slow');
  75. if(CUSTOMMENU_POPUP_EFFECT == 1) $(this).find('.popup').stop(true,true).fadeIn('slow');
  76. if(CUSTOMMENU_POPUP_EFFECT == 2) $(this).find('.popup').stop(true,true).show('slow');
  77. },function(){
  78. if(CUSTOMMENU_POPUP_EFFECT == 0) $(this).find('.popup').stop(true,true).slideUp();
  79. if(CUSTOMMENU_POPUP_EFFECT == 1) $(this).find('.popup').stop(true,true).fadeOut('slow');
  80. if(CUSTOMMENU_POPUP_EFFECT == 2) $(this).find('.popup').stop(true,true).hide('fast');
  81. })
  82. });


Plik .tpl
  1. <div class="navleft-container">
  2. <div id="pt_vmegamenu" class="pt_vmegamenu">
  3. <div class="megamenu-title">
  4. <h2>
  5. <i class="fa fa-bars"></i>
  6. {l s='Categories' mod='posvegamenu'}
  7. </h2>
  8. </div>
  9. <div class="vegamenu-content">
  10. {$megamenu}
  11. </div>
  12. </div>
  13. </div>
  14.  
  15.  
  16. <script type="text/javascript">
  17. //<![CDATA[
  18. var VMEGAMENU_POPUP_EFFECT = {$effect};
  19. //]]>
  20.  
  21. $(document).ready(function(){
  22. $("#pt_ver_menu_link ul li").each(function(){
  23. var url = document.URL;
  24. $("#pt_ver_menu_link ul li a").removeClass("act");
  25. $('#pt_ver_menu_link ul li a[href="'+url+'"]').addClass('act');
  26. });
  27.  
  28. $('.pt_menu').hover(function(){
  29. if(VMEGAMENU_POPUP_EFFECT == 0) $(this).find('.popup').stop(true,true).slideDown('slow');
  30. if(VMEGAMENU_POPUP_EFFECT == 1) $(this).find('.popup').stop(true,true).fadeIn('slow');
  31. if(VMEGAMENU_POPUP_EFFECT == 2) $(this).find('.popup').stop(true,true).show('slow');
  32. },function(){
  33. if(VMEGAMENU_POPUP_EFFECT == 0) $(this).find('.popup').stop(true,true).slideUp('fast');
  34. if(VMEGAMENU_POPUP_EFFECT == 1) $(this).find('.popup').stop(true,true).fadeOut('fast');
  35. if(VMEGAMENU_POPUP_EFFECT == 2) $(this).find('.popup').stop(true,true).hide('fast');
  36. })
  37.  
  38. $('.megamenu-title').bind('click', function() {
  39. $('.vegamenu-content').slideToggle(0);
  40. $(".vegamenu-content").css("overflow","visible");
  41. });
  42. });
  43.  


liczę na jakieś podpowiedzi smile.gif