Advertisement
Guest User

main.js

a guest
Nov 25th, 2021
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(".menu").siblings().hide();
  2. $("#submit").show();
  3.  
  4. //$("input[type='submit']").show();
  5. //$("input[type='file']").show();
  6. //$("#gallery").show();
  7. //$('.menu, .submenu, .scarpe').val('select');
  8.  
  9. $(".menu, .submenu1, .submenu2, .misure_magliette").on("change", function(){
  10.     val = $(this).val();
  11.     console.log(val);
  12.     $("."+val).show();
  13.    
  14.    
  15.     console.log($(this).attr("class"));
  16.     if($(this).attr("class") == "menu"){
  17.        
  18.         $("."+val).show();
  19.  
  20.         $("."+val).siblings().hide();
  21.         $("#submit").show();
  22.         $(".menu").show();
  23.         console.log("ok")
  24.  
  25.  
  26.     }
  27.     if($(this).attr("class") == "submenu1" || $(this).attr("class") == "submenu2"){
  28.         $("#gallery").show();
  29.  
  30.     }
  31.  
  32.  
  33. //    $("."+val).val('select');
  34. //    $("."+val).siblings().hide();
  35.  
  36. });
  37.  
  38.  
  39. $("input[type='number']").mouseout(function(){
  40.     console.log($(this).val());
  41. })
  42. $("input[type='submit']").mouseover(function(){
  43.  
  44. })
  45.  
  46.  
  47. //var fileInput = document.getElementById('file_input');
  48. //fileInput = $(".file_input");
  49. cont =0;
  50. rotate = 0;
  51.  
  52.  
  53. $(".file_input")[cont].on("change", () => {
  54. //cont++;
  55. //rotate -= 90;
  56.  
  57.  
  58.     div = document.createElement("div");
  59.  
  60.     for(let file of fileInput.files) {
  61.         var image = file
  62.         if (image) {
  63.             var imageElement = new Image();
  64.             imageElement.src = URL.createObjectURL(image);
  65.             imageElement.width = 100;
  66.        
  67.  
  68.             var imageElement2 = new Image();
  69.             imageElement2.src = "https://img.icons8.com/material-two-tone/24/000000/rotate-left.png";
  70.  
  71.             //imageElement2.width = 100;
  72.  
  73.             var imageElement3 = new Image();
  74.             imageElement3.src="https://img.icons8.com/material-rounded/24/000000/rotate-right.png";
  75.      
  76.             var imageElement4 = new Image();
  77.             imageElement4.src="https://img.icons8.com/material-two-tone/24/000000/remove-image.png";
  78.  
  79.             document.getElementById('gallery').appendChild(div);
  80.             div.appendChild(imageElement2);
  81.  
  82.             div.appendChild(imageElement3);
  83.             div.appendChild(imageElement4);
  84.             div.appendChild(imageElement);
  85.  
  86.             $(imageElement2).click(function(){
  87.                 rotate = rotate - 90;
  88.                 //    rrotate = rotate + 90;
  89.  
  90.  
  91.                 console.log(7)
  92.                 $(imageElement).css("transform", "rotate("+rotate+"deg)");
  93.                 // $(imageElement).css("transform", "rotate("+lrotate+"deg)");
  94.  
  95.             });
  96.  
  97.             $(imageElement3).click(function(){
  98.                 // lrotate = rotate - 90;
  99.                 rotate = rotate + 90;
  100.  
  101.  
  102.                 console.log(7)
  103.                 // $(imageElement).css("transform", "rotate("+lrotate+"deg)");
  104.                 $(imageElement).css("transform", "rotate("+rotate+"deg)");
  105.  
  106.             });
  107.  
  108.             $(imageElement4).click(()=>{
  109.                 $(imageElement).css("display","none");
  110.             })
  111.  
  112.  
  113.         }
  114.     }
  115.     $("img").click(function(){
  116.         console.log(4);
  117.     })
  118.   cont++
  119. });
  120.  
  121.  
  122. //cont=0;
  123. $("#addimg").click(()=>{
  124.   //  cont++
  125.     $(".file_input")[cont].click();
  126. })
  127.  
  128.  
  129. /*
  130. imageElement2.addEventListener("click", ()=>{
  131.  
  132.  
  133.  
  134. })
  135. */
  136.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement