Javascript 使用jqueryRotate插件将图像旋转90度

Javascript 使用jqueryRotate插件将图像旋转90度,javascript,jquery,html,rotation,Javascript,Jquery,Html,Rotation,我不知道这是否可能。我在一个网页上有10张图片。我希望能够旋转我用JQueryRotate脚本点击的任何图像。我只是不知道如何实施它。任何帮助都将不胜感激 这是我的图片的HTML代码 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <t

我不知道这是否可能。我在一个网页上有10张图片。我希望能够旋转我用JQueryRotate脚本点击的任何图像。我只是不知道如何实施它。任何帮助都将不胜感激

这是我的图片的HTML代码

    <!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>About Us</title>
    <link rel="stylesheet" type="text/css" href="styles/about-us_style.css">
    <script src="https://code.jquery.com/jquery-2.2.3.js" integrity="sha256-laXWtGydpwqJ8JA+X9x2miwmaiKhn8tVmOVEigRNtP4=" crossorigin="anonymous">
    $(document).ready(function() {

  $('img').click(function() {
            $(this).toggleClass('rotate');
        });
});</script>
  </head>
  <body>

    <div id=body-content>
      <ul>
        <li><a href="home-page.html">Home Page</a><br></li>
        <li><a href="about-us.html">About us</a><br></li>
        <li><a href="contact-us.html">Contact us</a><br></li>
        <li><a href="login.html">login</a><br></li>
      </ul>

      <div id=main_menu>
        <p id=main-menu-paragrapf>
         Car Gallery
        </p>
        <div id="car1" class="polaroid">
          <img src="http://i1216.photobucket.com/albums/dd368/RenierSwart/9.ferrari-dino.jpg" alt="Norway" style="width:100%">
          <div class="container">
            <p><span id="heading">Ferrari Dino (1968–1972)</span><br>Launched in 1968, came equipped with a V-6 instead of the typical V-12.</p>
          </div>
        </div>


        <div id="car2" class="polaroid">
          <img src="http://i1216.photobucket.com/albums/dd368/RenierSwart/1.ferrari-250-gto_1.jpg" alt="Norway" style="width:100%">
          <div class="container">
            <p><span id="heading">Ferrari 250 GTO (1962-1964)</span><br>A stunning shape and incredible 3.0-liter V-12 makes this the definitive exotic. </p>
          </div>
        </div>

          <div id="car3" class="polaroid">
          <img src="http://i1216.photobucket.com/albums/dd368/RenierSwart/6.porsche-550-spyder.jpg" alt="Norway" style="width:100%">
          <div class="container">
            <p><span id="heading">Porsche 550 (1953–1956)</span><br>The 550 Spyder was  low-riding convertible that helped solidify Porsche's worldwide fame. </p>
          </div>
        </div>

        <div id="car4" class="polaroid">
          <img src="http://i1216.photobucket.com/albums/dd368/RenierSwart/8.lamborghini-miura.jpg" alt="Norway" style="width:100%">
          <div class="container">
            <p><span id="heading">Lamborghini Miura (1966–1972)</span><br>The Miura was Lamborghini's original midengined supercar.</p>
          </div>
        </div>

        <div id="car5" class="polaroid">
          <img src="http://i1216.photobucket.com/albums/dd368/RenierSwart/7.chevy-corvette.jpg" alt="Norway" style="width:100%">
          <div class="container">
            <p><span id="heading">Chevrolet Corvette (1963–1967)</span><br>The second generation Sting Ray marked the first fixed-roof Corvette coupe. </p>
          </div>
        </div>
         <div id="car6" class="polaroid">
          <img src="http://i1216.photobucket.com/albums/dd368/RenierSwart/4.ferrari-330-p4.jpg" alt="Norway" style="width:100%">
          <div class="container">
            <p><span id="heading">Ferrari 330 P4 (1967)</span><br>Only three were ever made. The V12 put out up to 450 hp. </p>
          </div>
        </div>
        <div id="car7" class="polaroid">
          <img src="http://i1216.photobucket.com/albums/dd368/RenierSwart/5.jaguar-e-type.jpg" alt="Norway" style="width:100%">
          <div class="container">
            <p><span id="heading">Jaguar E-Type (1961–1975)</span><br>Its famous shape hid  a 5.3-liter V-12 under the long hood. </p>
          </div>
        </div>
        <div id="car8" class="polaroid">
          <img src="http://i1216.photobucket.com/albums/dd368/RenierSwart/3.jaguar-xj13.jpg" alt="Norway" style="width:100%">
          <div class="container">
            <p><span id="heading">Jaguar XJ13 (1965)</span><br>The XJ13 is the greatest-looking designs. This prototype bridged the gap between D-Type and E-Type Jags </p>
          </div>
        </div>
        <div id="car9" class="polaroid">
          <img src="http://i1216.photobucket.com/albums/dd368/RenierSwart/2.alfa-romeo-33.jpg" alt="Norway" style="width:100%">
          <div class="container">
            <p><span id="heading">Alfa Romeo 33 Stradale (1967–1971)</span><br>The Alfa's T33 race car may be the pinnacle European '60s automotive style. It's thought to be the first car with butterfly doors </p>
          </div>
        </div>
        <div id="car10" class="polaroid">
          <img src="http://i1216.photobucket.com/albums/dd368/RenierSwart/10.mercedes-benz-300sl-gullwing.jpg" alt="Norway" style="width:100%">
          <div class="container">
            <p><span id="heading">Mercedes-Benz 300SL "Gullwing" (1955–1957)</span><br>The 300SL, famous for its gullwing doors that opened toward the sky, opens the top 10. Many have hailed the Benz as the world's first supercar. </p>
          </div>
        </div>

      </div>
    </div>

    <div id=images>

      <div id=logos>
        <img src="http://www.otopark.com/wp-content/uploads/2016/02/volvo-cars-logo-emblem.jpg" alt="W3Schools.com" style="width:75px;height:75px;">
        <img src="https://8096-presscdn-0-43-pagely.netdna-ssl.com/wp-content/uploads/2014/10/hyundai-logo.jpg" style="width:75px;height:75px;">
        <img src="https://8096-presscdn-0-43-pagely.netdna-ssl.com/wp-content/uploads/2014/10/ferrari-logo.jpg" alt="W3Schools.com" style="width:75px;height:75px;">
      </div>

    </div>


    <div id=footer>
      Website developed
    </div>


  </body>
</html>

关于我们
$(文档).ready(函数(){
$('img')。单击(函数(){
$(this.toggleClass('rotate');
});
});




汽车走廊

法拉利迪诺(1968-1972)
于1968年推出,配备了V-6而不是典型的V-12

法拉利250 GTO(1962-1964)
令人惊叹的外形和令人难以置信的3.0升V-12使这款车成为最具异国情调的车型

保时捷550(1953-1956)
550 Spyder是一款低骑乘敞篷车,帮助巩固了保时捷的全球声誉

兰博基尼三浦(1966-1972)
三浦是兰博基尼最初的中置引擎超级跑车

雪佛兰Corvette(1963-1967)
第二代Sting Ray标志着第一款固定顶Corvette轿跑车

法拉利330 P4(1967)
仅生产过三辆。V12的输出功率高达450马力

捷豹E-Type(1961–1975)
其著名的外形将一辆5.3升V-12隐藏在长发动机罩下

捷豹XJ13(1965)
XJ13是最漂亮的设计。该原型填补了D型和E型JAG之间的空白

阿尔法·罗密欧33斯特拉代尔(1967-1971)
阿尔法的T33赛车可能是60年代欧洲汽车风格的巅峰之作。这被认为是第一辆有蝴蝶门的汽车

梅赛德斯-奔驰300SL“鸥翼”(1955-1957年)
300SL以其朝天开启的鸥翼车门而闻名,跻身前10名。许多人称赞奔驰是世界上第一辆超级跑车

网站开发
除了标准jQuery,您不需要任何东西!使用CSS3转换

CSS:

jQuery:

$(document).ready(function() {

  $('img').click(function() {
            $(this).toggleClass('rotate');
        });
});

当然,您可以更改旋转角度的数量以满足您的需要

您只需要标准jQuery!使用CSS3转换

CSS:

jQuery:

$(document).ready(function() {

  $('img').click(function() {
            $(this).toggleClass('rotate');
        });
});

当然,您可以更改旋转角度的数量以满足您的需要

给出了未捕获的例外情况。$未定义这意味着您没有正确设置jQuery。确保在您自己的jQuery脚本上方包含
,最好是在更新问题的页面的
中。单击图像时仍然没有发生任何事情这里有一些更基本的问题,请查看更新的代码。您希望将实际的JavaScript/jQuery代码与HTML分开保存在一个.js文件中。阅读jQuery基础知识更多信息:。CSS3在这里转换:对不起,我帮不上什么忙了!它在这个代码笔中工作:给出未捕获的异常未定义这意味着您没有正确设置jQuery。确保在您自己的jQuery脚本上方包含
,最好是在更新问题的页面的
中。单击图像时仍然没有发生任何事情这里有一些更基本的问题,请查看更新的代码。您希望将实际的JavaScript/jQuery代码与HTML分开保存在一个.js文件中。阅读jQuery基础知识更多信息:。CSS3在这里转换:对不起,我帮不上什么忙了!它在这个代码笔中工作: