/themes/leo_shoesworld/modules/leobootstrapmenu/views/templates/hook/megamenu.tpl

https://gitlab.com/ptisky/API_prestashop · Smarty Template · 111 lines · 109 code · 2 blank · 0 comment · 23 complexity · 6e4b62b6da00a7ec7a2abd3a6a2519d2 MD5 · raw file

  1. <div id="leo-megamenu" class="clearfix">
  2. <nav id="cavas_menu" class="sf-contener leo-megamenu">
  3. <div class="" role="navigation">
  4. <!-- Brand and toggle get grouped for better mobile display -->
  5. <div class="navbar-header">
  6. <button type="button" class="navbar-toggle btn-outline-inverse" data-toggle="collapse" data-target=".navbar-ex1-collapse">
  7. <span class="sr-only">{l s='Toggle navigation' mod='leobootstrapmenu'}</span>
  8. <span class="fa fa-bars"></span>
  9. </button>
  10. </div>
  11. <!-- Collect the nav links, forms, and other content for toggling -->
  12. <div id="leo-top-menu" class="collapse navbar-collapse navbar-ex1-collapse">
  13. {$boostrapmenu}
  14. </div>
  15. </div>
  16. </nav>
  17. </div>
  18. <script type="text/javascript">{literal}
  19. // <![CDATA[
  20. var current_link = "{/literal}{$current_link}{literal}";
  21. //alert(request);
  22. var currentURL = window.location;
  23. currentURL = String(currentURL);
  24. currentURL = currentURL.replace("https://","").replace("http://","").replace("www.","").replace( /#\w*/, "" );
  25. current_link = current_link.replace("https://","").replace("http://","").replace("www.","");
  26. isHomeMenu = 0;
  27. if($("body").attr("id")=="index") isHomeMenu = 1;
  28. $(".megamenu > li > a").each(function() {
  29. menuURL = $(this).attr("href").replace("https://","").replace("http://","").replace("www.","").replace( /#\w*/, "" );
  30. if( (currentURL == menuURL) || (currentURL.replace(current_link,"") == menuURL) || isHomeMenu){
  31. $(this).parent().addClass("active");
  32. return false;
  33. }
  34. });
  35. // ]]>
  36. {/literal}</script>
  37. {if $show_cavas && $show_cavas == 1}
  38. <script type="text/javascript">{literal}
  39. (function($) {
  40. $.fn.OffCavasmenu = function(opts) {
  41. // default configuration
  42. var config = $.extend({}, {
  43. opt1: null,
  44. text_warning_select: "{/literal}{l s='Please select One to remove?' mod='leobootstrapmenu'}",{literal}
  45. text_confirm_remove: "{/literal}{l s='Are you sure to remove footer row?' mod='leobootstrapmenu'}",{literal}
  46. JSON: null
  47. }, opts);
  48. // main function
  49. // initialize every element
  50. this.each(function() {
  51. var $btn = $('#cavas_menu .navbar-toggle');
  52. var $nav = null;
  53. if (!$btn.length)
  54. return;
  55. var $nav = $('<section id="off-canvas-nav" class="leo-megamenu"><nav class="offcanvas-mainnav" ><div id="off-canvas-button"><span class="off-canvas-nav"></span>{/literal}{l s='Close' mod='leobootstrapmenu'}{literal}</div></nav></sections>');
  56. var $menucontent = $($btn.data('target')).find('.megamenu').clone();
  57. $("body").append($nav);
  58. $("#off-canvas-nav .offcanvas-mainnav").append($menucontent);
  59. $("#off-canvas-nav .offcanvas-mainnav").css('min-height',$(window).height()+30+"px");
  60. $("html").addClass ("off-canvas");
  61. $("#off-canvas-button").click( function(){
  62. $btn.click();
  63. } );
  64. $btn.toggle(function() {
  65. $("body").removeClass("off-canvas-inactive").addClass("off-canvas-active");
  66. }, function() {
  67. $("body").removeClass("off-canvas-active").addClass("off-canvas-inactive");
  68. });
  69. });
  70. return this;
  71. }
  72. })(jQuery);
  73. $(document).ready(function() {
  74. jQuery("#cavas_menu").OffCavasmenu();
  75. $('#cavas_menu .navbar-toggle').click(function() {
  76. $('body,html').animate({
  77. scrollTop: 0
  78. }, 0);
  79. return false;
  80. });
  81. });
  82. $(document.body).on('click', '[data-toggle="dropdown"]' ,function(){
  83. if(!$(this).parent().hasClass('open') && this.href && this.href != '#'){
  84. window.location.href = this.href;
  85. }
  86. });
  87. {/literal}</script>
  88. {else}
  89. <script type="text/javascript">{literal}
  90. $(document).ready(function() {
  91. if($(window).width() <= 767){
  92. $('#cavas_menu').addClass("off-canvas-type");
  93. }
  94. $(document.body).on('click', '[data-toggle="dropdown"]' ,function(){
  95. if(!$(this).parent().hasClass('open') && this.href && this.href != '#' && !$('#cavas_menu').hasClass('off-canvas-type')){
  96. window.location.href = this.href;
  97. }
  98. });
  99. });
  100. $(window).resize(function() {
  101. if( $(window).width() <= 767 ){
  102. $('#cavas_menu').addClass("off-canvas-type");
  103. }
  104. else {
  105. $('#cavas_menu').removeClass("off-canvas-type");
  106. }
  107. });
  108. {/literal}</script>
  109. {/if}