-1

我是 jquery 的新手。我的新任务是“jquery 中的 imgareaselect”。我指的是这个。但我缺乏理解逻辑的地方。请帮我创建“imgareaselect”

现在我的编码是:

<!DOCTYPE html>
  <html>
    <head>
     <script src="http://odyniec.net/projects/imgareaselect/jquery.imgareaselect.pack.js">     </script>
      <script src="http://odyniec.net/projects/imgareaselect/css/imgareaselect-animated.css"></script>
      <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
    </head>
    <body>
      <img id="photo" src="https://www.google.com/images/srpr/logo11w.png" />
        <script>
          $('img#photo').imgAreaSelect({
            handles: true,
            onSelectEnd: function (img, selection) {
             alert('width: ' + selection.width + '; height: ' + selection.height);
           }
         });
        </script>
      </body>
   </html>
4

1 回答 1

0

带有 JAVASCRIPT 的 HTML

...
<head>
<script src="http://odyniec.net/projects/imgareaselect/jquery.imgareaselect.pack.js"></script>
<script src="http://odyniec.net/projects/imgareaselect/css/imgareaselect-animated.css"></script>
</head>

<body>

    <img id="photo" src="https://www.google.com/images/srpr/logo11w.png" />

    <script>
    $('img#photo').imgAreaSelect({
        handles: true,
        onSelectEnd: function (img, selection) {
            alert('width: ' + selection.width + '; height: ' + selection.height);
        }
    });
    </script>

</body>
...

尝试一下并在fiddle上进行实验。阅读文档,您可以看到限制。

于 2013-12-12T07:12:29.477 回答