Yes, this is not very difficult to accomplish.
First - You need to get the select event
The select event is sent to an element when the user makes a text selection inside it. This event is limited to fields and boxes.
For example, consider the HTML:
<form>
<input id="target" type="text" value="Hello there" />
</form>
<div id="other">
Trigger the handler
</div>
The event handler can be bound to the text input:
$('#target').select(function() {
alert('Handler for .select() called.');
});
SEE: http://api.jquery.com/select/
Second - You need to create a tag
CSS
<style>
body{font-size:12px; font-family:"Trebuchet MS";}
#content1{
border:1px solid #CCCC33;
padding:10px;
margin-top:10px;
width:500px;
}
</style>
(X)HTML
<a href="#" id="click">Something Here</a>
<div class="box">
<div id="content1">
<p><a href="#" id="close">Close</a></p>
</div>
</div>
</body>
As you can see it is a very simple example, but the use of this it just about limitless!
Now for the jQuery code that does all the funky stuff. What I am going to do is Show and Hide the Content1 Div element. For that I created the jQuery code below, have a look then I will go through it.
$(document).ready(function(){
$('#content1').hide();
$('a').click(function(){
$('#content1').show('slow');
});
$('a#close').click(function(){
$('#content1').hide('slow');
})
});
As I mentioned earlier the $(document).ready(function()} is a function that waits until the page is ready to be manipulated before executing the code inside it.
The next line $('#content1').hide(); Hides the Content1 Div to start with. Notice how there is a relationship between jQuery and CSS in that is uses the, ID is this case, but it could use a class in exactly the same manner, as the argument inside the parenthesis.
We then move onto the next section of code that “Shows” the DIV when the linked text is clicked. $('a).click(function(){}); This is calling the “click” function and then invoking the “show” effect on the Content1 Div.
Read the code again and make sure you get a grip on the logic. It took me a little while to get the hang of it as well !!!
Inside that Div that is being Shown and Hidden there is another text link that will Hide the Div.
$('a#close').click(function(){
$('#content1').hide('slow');
})
If you look at this you can see that any “a” (link) element with an ID of “close” will invoke the “hide” Effect on the Content 1 Div.
SEE: http://dreamweaverspot.com/jquery-show-and-hide-a-div/
Third - Draw your line
Download Plugin for jQuery SVG - http://jquery.com/plugins/project/svg
Draw your line
$("#example1").drawLine(0, 0, 220, 45);
SEE: http://www.openstudio.fr/Library-for-simple-drawing-with.html
That's it. Just put it all together to get it how you want it.