jQuery删除通过jQuery SVG库添加的绘制线 [英] Jquery remove drawn line added via jquery svg library

查看:161
本文介绍了jQuery删除通过jQuery SVG库添加的绘制线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我有一条线通过jQuery SVG插件从一个表单元格绘制到另一单元格.遵循博客文章的步骤 http://www.openstudio.fr /Library-for-simple-drawing-with.html 我设法添加了它.但是同时,当鼠标悬停时,我需要删除该线并将其绘制在另一个位置上.有没有删除画线的方法,还是应该采用其他方法来隐藏或删除画线?任何帮助都将受到高度赞赏.

In my application I have a line drawn from one table cell to another cell through jQuery SVG plugin. Following the steps of the blog post http://www.openstudio.fr/Library-for-simple-drawing-with.html I managed to add it. But at the same time I need to remove that line and draw it on another place when mouse hovers. Is there a method to remove the drawn line or should I follow a different methodology to hide it or remove it ? Any help is highly appreciated.

推荐答案

根据文档,行功能返回一个svg <line>元素,因此您应该能够使用标准DOM核心方法removeChild()将该元素删除.

According to the documentation the line function returns an svg <line> element, so you should be able to remove it using the standard DOM core method removeChild().

未经测试,但希望能正常工作:

Untested, but hopefully working:

var myline = svg.line(parent, x1, y1, x2, y2, settings);
parent.removeChild(myline);

这篇关于jQuery删除通过jQuery SVG库添加的绘制线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆