如何拖拽删除SVG元素?

时间:2015-06-12 08:13:21

标签: javascript jquery html css svg

我想通过Drag& amp;来交换这个难题的元素。通过点击删除而不是交换。事实上,我想做一个三角形拼图,我的网络用户可以通过一些元素填充空白字段,并通过拖放交换该拼图的元素。像这样example image

我该怎么办?!请帮助我。

Fiddle here...



[error] s.c.p.TwitterProvider - [securesocial] error retrieving request token
oauth.signpost.exception.OAuthNotAuthorizedException: Authorization failed (server replied with a 401). This can happen if the consumer key was not correct or the signatures did not match.
    at oauth.signpost.AbstractOAuthProvider.handleUnexpectedResponse(AbstractOAuthProvider.java:243) ~[signpost-core-1.2.1.2.jar:na]
    at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:193) ~[signpost-core-1.2.1.2.jar:na]
    at oauth.signpost.AbstractOAuthProvider.retrieveRequestToken(AbstractOAuthProvider.java:74) ~[signpost-core-1.2.1.2.jar:na]
    at play.api.libs.oauth.OAuth.retrieveRequestToken(OAuth.scala:38) ~[play-ws_2.11-2.3.7.jar:2.3.7]
    at securesocial.core.OAuth1Client$Default$$anonfun$retrieveRequestToken$1.apply(OAuth1Provider.scala:69) ~[securesocial_2.11-3.0-M3.jar:3.0-M3]
[error] s.c.ProviderController - Unable to log user in. An exception was thrown
securesocial.core.AuthenticationException: null
    at securesocial.core.OAuth1Provider$$anonfun$authenticate$1.applyOrElse(OAuth1Provider.scala:141) ~[securesocial_2.11-3.0-M3.jar:3.0-M3]
    at securesocial.core.OAuth1Provider$$anonfun$authenticate$1.applyOrElse(OAuth1Provider.scala:138) ~[securesocial_2.11-3.0-M3.jar:3.0-M3]
    at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36) [scala-library-2.11.6.jar:na]
    at scala.util.Failure$$anonfun$recover$1.apply(Try.scala:215) [scala-library-2.11.6.jar:na]
    at scala.util.Try$.apply(Try.scala:191) [scala-library-2.11.6.jar:na]

var step = 0;
var $prev;

$("polygon").on("click", function() {
    switch (step) {
        // if it's the first step: save the current element for later
        case 0:
            step = 1;
            $prev = $(this);
            break;
        // if it's the second step: swap images and start again
        case 1:
            step = 0;
            var aux = $prev.attr("fill");
            $prev.attr("fill", $(this).attr("fill"));
            $(this).attr("fill", aux);
            break;
    }
});

polygon, path {
    opacity:0.5;
    transition:all 0.5s;
}

polygon:hover, path:hover {
    opacity:1;
}




0 个答案:

没有答案