Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. $(document).ready(function() {
  2. $(".delWishes").click(function () {
  3. var product= $(this).attr('data-productid');
  4. $.ajax({
  5. url: "/ajax/wishNew.php",
  6. type: 'post',
  7. data: {product_id: product},
  8. context: this,
  9. success: function (data) {
  10. $("#fav_prod_"+product).remove();
  11. $('#countWish').text(data);
  12. },
  13. });
  14.  
  15. });
  16.  
  17. if($('#countWish').html() == 0){
  18. $('.catalog-item-fav.favorite_check').removeClass('checked');
  19. };
  20. $(document).on("click", ".cookie_alert_close", function () {
  21. BX.setCookie('cookie_alert', 'Y', {expires: 999999999, path: '/'});
  22. $('.cookie_alert').remove();
  23. });
  24. $(document).on("click", ".getCouponRegister", function(){
  25. $('.lc-btn').click();
  26. setTimeout(function(){
  27. $('[data-form="reg"]').click();
  28. },20);
  29. });
  30. });
  31.  
  32.  
  33. (function () {
  34. var totalWidth = 0;
  35. var rowNum = 1;
  36. var tagsBlockWidth = $('.tags-block').outerWidth() - 10;
  37. var allTagsWidth = $('.tags-collapse').outerWidth() + 20;
  38.  
  39. $('.tags-block a.tag').each(function () {
  40. var width = $(this).outerWidth() + 19;
  41.  
  42. if (rowNum < 3)
  43. totalWidth += width;
  44.  
  45. if (totalWidth > tagsBlockWidth && rowNum === 1) {
  46. totalWidth = width + allTagsWidth;
  47. rowNum = 2;
  48. }
  49. if (totalWidth > tagsBlockWidth && rowNum === 2) {
  50. rowNum = 3;
  51. }
  52. if (rowNum === 3) {
  53. $(this).addClass('all-tag').addClass('hidden-tag');
  54. }
  55. });
  56. if (rowNum < 3)
  57. $('.tags-collapse').remove();
  58. $('.tags-block').addClass('active');
  59.  
  60. $(".tags-collapse").click(function () {
  61. if ($(".all-tag.hidden-tag").length > 0) {
  62. $(".tags-collapse").text("Основные метки");
  63. $(".all-tag").removeClass("hidden-tag");
  64. } else {
  65. $(".tags-collapse").text("Все метки");
  66. $(".all-tag").addClass("hidden-tag");
  67. }
  68. });
  69. }());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement