Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Javascript to show Link Description?

Quote Reply
Javascript to show Link Description?
Heya all,

Checking to see if anyone has done this. I'm looking for JS that will desplay the decsription of a link when passing it the LinkID.

We've got a some pretty good FAQs, where each FAQ is saved as a "link" in GLinks. The body of the FAQ is in the description field. I'd like to be able to add some info/help links on the site where needed. When a user click on these a JS pop-up should appear with the content from the related FAQ. The LinkID can be passed through the info link.

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Javascript to show Link Description? In reply to
Hi,

If I have understood what you are trying to do, I use the following to display the beginning of the description of the link :

<a title="<%Title%> : &#168;<%field_shorten($Description,'150')%>&#168;" href="<%detailed_url%>"><%Title%></a>

with

a global from one of your threads :) to shorten the field :
http://www.gossamer-threads.com/...0description;#268920

It's not javascipt but will require far less code. Let me know if you are really stuck on javascript since I also use some code on another site that creates a box type system on mouseover but it's more complicated to get working.

Hope this helps !

John
Significant Media
Quote Reply
Re: [Jag] Javascript to show Link Description? In reply to
Hey John,

Here's what I'm trying to do: Look on this page.

In the person's profile you'll see a line that reads:
Quote:
Power = 559 (Vote Weight = 96.77%)

Click on the little icon. I want to save the content that pops-up in GLinks db. I have many little information icons all over the site, not all in GLinks, some are in the forums.

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Javascript to show Link Description? In reply to
Hi sangiro,

It looks as if your example is in AJAX which is not too different from Javascript IMHO. The example I use looks pretty similar to your example except that it works with a mouseover rather than a mouseclick.

Here is an example of the code being used :
http://alventyr.net/maps.php

Here is the official page by the author:
http://www.dustindiaz.com/sweet-titles

I prefer mouseover rather than mouseclick after finding that several people didn't understand they needed to click to get the info whereas mouseover comes with the territory.

Hope this helps !

John

PS : for discussion's sake there is an issue with the fact that some browsers will display a value provide in title and this is sometimes displayed over the top of the box that is created by the above code.
Significant Media

Last edited by:

Jag: Jun 17, 2006, 10:06 AM
Quote Reply
Re: [sangiro] Javascript to show Link Description? In reply to
I think its possible to realise it wit a Div container.
Then you can use on mouseover is making the div container visible.

Try it out in dreamweaver. It makes it - i think - in the behaviours.

Maybe i find it ...


.....argggghh... i cant use the behaviours in dreamweaver to let create the code to make the div container visible....

sorry

manne


http://www.edelsteine.de

Last edited by:

manne: Jun 17, 2006, 11:33 AM
Quote Reply
Re: [Jag] Javascript to show Link Description? In reply to
Jag - thanks for the reply. I do not want to load the content of each information tag onto the page though. I only want to go grab that information from the database when the user asks for it.

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Javascript to show Link Description? In reply to
Hi sangiro,

For what it's worth the structure to get this working relies upon the title value and thus is data that in several search engines will be considered when the page is indexed.
Also when more and more people are on broadband having a few more bytes compared to a second http and database call for such a small amount of data seems acceptable in my opinion.

I haven't come across the code that you require. I was also thinking that the data you need to insert in the above suggested ajax version would already be available in one database call.

I'll let you know if I come across something.

John
Significant Media
Quote Reply
Re: [sangiro] Javascript to show Link Description? In reply to
Maybe this thread will give you some ideas on how to query the database:

http://www.gossamer-threads.com/...orum.cgi?post=275691


PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [sangiro] Javascript to show Link Description? In reply to
Hi Sangiro,

If you're interested to see what this looks like I have done a test page here :

http://www.significant-media.com/titles.html

Thought you might be interested to see a specific example. I still have a few things to tweak since I am having trouble getting opacity working in IE but it works OK in FireFox.

Cheers,

John
Significant Media
Quote Reply
Re: [Jag] Javascript to show Link Description? In reply to
John,

Nice job on the tool tips! Smile I suspect presenting the information via a css div would not be too hard to do. I'm going to continue looking for a solution that only loads the data upon request. If I don't have too many information links per page I may end up using something similar to what you have. Cool

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Javascript to show Link Description? In reply to
Hi sangiro,

Let me know if you are interested and I'll send you the version I modified to only display the titles of links that are identified with a CSS class.

John
Significant Media
Quote Reply
Re: [sangiro] Javascript to show Link Description? In reply to
Check this:
http://www.dhtmlgoodies.com/index.html?whichScript=ajax-tooltip
Quote Reply
Re: [gotze] Javascript to show Link Description? In reply to
Hi gotze,

That's a cool example, it worked fine in FireFox and IE, though I couldn't get it to work in Opera. I was confused by the advert pop-ups to begin with thinking they were the demo.
I find that the advantage of the above from Dustin Diaz is that the title value used is also taken into account by search engines whereas in this case it is also a mouseover trigger but the content is not included in the page. Also it has limited impact on bandwidth.
I'd be interested to know what people think about this ?

Cheers,

John
Significant Media
Quote Reply
Re: [gotze] Javascript to show Link Description? In reply to
In Reply To:
Check this:
http://www.dhtmlgoodies.com/index.html?whichScript=ajax-tooltip

Yup - that worked for me. Thanks! Cool

John - I'm not too concerned that this isn't working in some Opera browsers as it's a mouse-over and a clickable link. Just point your link to the file that the mouse-over would have called in the first place and you have a nice alternative for non-JS browsers.

Thanks for the help!

Safe swoops
Sangiro