相关疑难解决方法(0)

SVG可以使用JQuery和Jquery-svg拖动

我有一个HTML 5页面,我加载一个svg圈.当我点击圆圈时,我会创建另一个小圆圈,然后单击.我希望能够拖动第二个圆圈,但似乎无法使用jquery-ui .draggable();

我可以通过访问它的cx和cy属性来移动圆圈,因此必须有一种方法来拖动它.

    <!DOCTYPE HTML> 
<html >
<head>
<title></title>
<link href="css/reset.css" rel="stylesheet" type="text/css">
<link href="css/layout.css" rel="stylesheet" type="text/css">
<link href="css/style.css" rel="stylesheet" type="text/css">
<script src="js/jquery.js" type="text/javascript" ></script>
<script src="js/jquerysvg/jquery.svg.js" type="text/javascript" ></script>
<script src="js/jquery-ui.js" type="text/javascript" ></script>
<script type="text/javascript" >
jQuery(document).ready(function(){
    $('#target').svg({onLoad: drawInitial});
    $('circle').click(function(e){
        drawShape(e);
        var shape = this.id;

    });

    $('.drag').mousedown(function(e){
        var shape = this.id;
        this.setAttribute("cx", e.pageX);
        this.setAttribute("cy", e.pageY);
    });
})

function drawInitial(svg) {
    svg.add($('#svginline')); 
}

function drawShape(e) {
    var svg = $("#target").svg('get');
    $('#result').text(e.clientX + ": " +  e.pageX);
    var dragme = svg.circle(e.clientX, …
Run Code Online (Sandbox Code Playgroud)

jquery svg jquery-ui

33
推荐指数
1
解决办法
4万
查看次数

如何使用jQuery为属性值(而不是样式属性)设置动画?

我需要为iframe的height属性设置动画,但似乎animate函数只接受样式属性.有什么想法吗?

iframe jquery animation

2
推荐指数
1
解决办法
1187
查看次数

标签 统计

jquery ×2

animation ×1

iframe ×1

jquery-ui ×1

svg ×1