custom.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. // Owl slider
  2. $(document).ready(function(){
  3. $('.oe_website_sale').each(function () {
  4. var oe_website_sale = this;
  5. $(oe_website_sale).on("change", ".oe_cart input.js_quantity", function () {
  6. setTimeout("location.reload();", 1000);
  7. });
  8. $(oe_website_sale).on('click', 'a.js_add_cart_json_new', function (ev) {
  9. ev.preventDefault();
  10. var $link = $(ev.currentTarget);
  11. var $input = $link.parent().parent().find("input");
  12. var value = parseInt(0, 10);
  13. var line_id = parseInt($input.data('line-id'),10);
  14. if (isNaN(value)) value = 0;
  15. openerp.jsonRpc("/shop/cart/update_json", 'call', {
  16. 'line_id': line_id,
  17. 'product_id': parseInt($input.data('product-id'),10),
  18. 'set_qty': value})
  19. .then(function (data) {
  20. if (!data.quantity) {
  21. location.reload();
  22. return;
  23. }
  24. });
  25. });
  26. });
  27. $('.owl-carousel').owlCarousel({
  28. loop:true,
  29. margin:30,
  30. responsiveClass:true,
  31. responsive:{
  32. 0:{
  33. items:1,
  34. nav:false,
  35. dots:true
  36. },
  37. 480:{
  38. items:2,
  39. nav:false,
  40. dots:true
  41. },
  42. 768:{
  43. items:3,
  44. nav:false,
  45. dots:true
  46. },
  47. 1000:{
  48. items:4,
  49. nav:true,
  50. loop:false,
  51. dots:false
  52. }
  53. }
  54. })
  55. });
  56. // header fix
  57. $(window).scroll(function(){
  58. if ($(window).scrollTop() >= 110) {
  59. $('.nav-top').addClass('navbar-fixed-top');
  60. }
  61. else {
  62. $('.nav-top').removeClass('navbar-fixed-top');
  63. }
  64. });
  65. $(window).load(function(){
  66. function resetHeight() {
  67. var maxHeight = 0;
  68. jQuery(".product .title").height("auto").each(function () {
  69. maxHeight = $(this).height() > maxHeight ? $(this).height() : maxHeight;
  70. }).height(maxHeight);
  71. }
  72. resetHeight();
  73. jQuery(window).resize(function () {
  74. resetHeight();
  75. });
  76. function resetHeight1() {
  77. var maxHeight = 0;
  78. jQuery(".product-img").height("auto").each(function () {
  79. maxHeight = $(this).height() > maxHeight ? $(this).height() : maxHeight;
  80. }).height(maxHeight);
  81. }
  82. resetHeight1();
  83. function resetHeight2() {
  84. var maxHeight = 0;
  85. jQuery(".product .price-box .oe_subdescription").height("auto").each(function() {
  86. maxHeight = $(this).height() > maxHeight ? $(this).height() : maxHeight;
  87. }).height(maxHeight);
  88. }
  89. resetHeight2();
  90. jQuery(window).resize(function () {
  91. resetHeight();
  92. resetHeight1();
  93. resetHeight2();
  94. });
  95. });
  96. $(window).load(function(){
  97. function resetHeight() {
  98. var maxHeight = 0;
  99. jQuery(".product .title").height("auto").each(function () {
  100. maxHeight = $(this).height() > maxHeight ? $(this).height() : maxHeight;
  101. }).height(maxHeight);
  102. }
  103. resetHeight();
  104. jQuery(window).resize(function () {
  105. resetHeight();
  106. });
  107. function resetHeight1() {
  108. var maxHeight = 0;
  109. jQuery(".item col-lg-4 col-md-4 col-sm-4 col-xs-6 .product-img1").height("auto").each(function () {
  110. maxHeight = $(this).height() > maxHeight ? $(this).height() : maxHeight;
  111. }).height(maxHeight);
  112. }
  113. resetHeight1();
  114. jQuery(window).resize(function () {
  115. resetHeight();
  116. resetHeight1();
  117. });
  118. });
  119. /*Added By BC 03-07-2015*/
  120. $(document).ready(function() {
  121. $("<span class='mob_sub'><span data-icon-name='plus'></span></span>").insertBefore(".mega-menu");
  122. $("<span class='mob_sub'><span data-icon-name='plus'></span></span>").insertBefore(".navbar-nav ul.mega-menu > .column > .js_usermenu");
  123. $("<span class='mob_sub'><span data-icon-name='plus'></span></span>").insertBefore(".navbar-nav ul.mega-menu > .column ul > li > ul");
  124. $('.mob_sub').click(
  125. function(e) {
  126. e.preventDefault(); // prevent the default action
  127. e.stopPropagation(); // stop the click from bubbling
  128. $(this).parent().toggleClass('selected');
  129. $(this).toggleClass('mob_sub_open');
  130. });
  131. });