Advertisement
tiberiugaspar

Untitled

Jan 6th, 2020
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready( function() {
  2.   let pret = parseFloat($('.price-item--regular')
  3.                         .html().replace('lei','').replace('.','').replace(',','.'));
  4.   pretFaraTva(pret);
  5.   valoareTva(pret);
  6.   changeTextColor();
  7.   onProductItemFocused();
  8.   changeIconSearch();
  9. });
  10.  
  11. function pretFaraTva(pret){
  12.   let valoare = (pret - calculTva(pret)).toFixed(2);
  13.   let element = '<div class="tva" id="pretFaraTva"> ' + 'Preț fără TVA: ' + valoare + ' lei </div>';
  14.   $(".product-single__meta .product__policies.rte").append(element);
  15. }
  16.  
  17. function valoareTva(pret){
  18.   let valoareTva = calculTva(pret);
  19.   let element = '<div class="tva" id="valoareTva"> ' + 'Valoare TVA: ' + valoareTva + ' lei </div>';
  20.   $(".product-single__meta .product__policies.rte").append(element);
  21.  
  22. }
  23.  
  24. function calculTva(pret){
  25.   let tva = 0.19 * pret;
  26.   return tva.toFixed(2);
  27. }
  28.  
  29. function onProductItemFocused(){
  30.   console.log("pana aici totul bine");
  31.   $('.grid-view-item__title .product-card__title').mouseenter(function() {
  32.     console.log("a functionat");
  33.     $('.product-card__title').css("color", "red");
  34.   });
  35.   $('.grid-view-item__title .product-card__title').mouseleave(function() {
  36.     console.log("a functionat");
  37.     $('.product-card__title').css("color","black");
  38.   });
  39. }
  40. function changeTextColor() {
  41.   $(".featured-row__subtext>p").mouseenter(function() {
  42.     $(".featured-row__subtext>p").css("color","red");
  43.     $(".featured-row__subtext>p").css("font-weight","bold");
  44.   })
  45.   $(".featured-row__subtext>p").mouseleave(function() {
  46.     $(".featured-row__subtext>p").css("color","black");
  47.     $(".featured-row__subtext>p").css("font-weight","normal");
  48.   })
  49. }
  50.  
  51. function changeIconSearch() {
  52.   $('.icon-search').mouseenter(function() {
  53.     $('.icon-search').animate({height: "35px", width:"31px"})
  54.   });
  55.   $('.icon-search').mouseleave(function() {
  56.     $('.icon-search').animate({height: "23px", width:"22px"})
  57.   });
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement