Attached is a patch that I think would be useful. It allows for the following code:
<p class="MyTooltips" id="something_unique">blah blah</p> <span id="cluetip_something_unique">Here's the text of the tooltip</span> <a href="#" id="something_else">click here!</a> <p id="cluetip_something_else">Here's another tooltip text.</p> $('.MyTooltips').cluetip({ autoid: true, local: true }); To me, it seems to make sense, as long as you are willing to name the tooltip text with the cluetip_ prefix on the id tag. This allows the various attributes to function as they are designed without conflict... On Fri, Jul 4, 2008 at 11:25 PM, David Morton <[EMAIL PROTECTED]> wrote: > As I somehow posted in another thread, sometimes the other attributes are > already in use. In this case, the href is already pointing to content, I > can't use it for the help text. > > I posted a little bit of code in the other thread, I may work on > embellishing it a bit. > > > On Fri, Jul 4, 2008 at 10:33 PM, Karl Swedberg <[EMAIL PROTECTED]> > wrote: > >> Sure, feel free to ask for feature enhancements here. >> Forgive me if you're already aware of this, but I thought I'd point out >> that you do not need to use the rel attribute to grab the content. You can >> use whatever attribute you'd like. In fact, if you're pointing to local >> content, it would make sense to use a link's href attribute to point to >> fetch the contents. That way, if JavaScript is turned off, you have an >> anchor link to the content on the page. You could use this HTML, for >> example: >> >> <a class="tip" href="#somecontent">link to clueTip contents</a> >> >> <div id="somecontent">this is the content that will show up in the >> clueTip</div> >> >> And this jQuery: >> >> $(document).ready(function() { >> $('a.tip').cluetip({ >> attribute: 'href', >> local: true >> }); >> }); >> >> Would this meet your need? >> >> --Karl >> ____________ >> Karl Swedberg >> www.englishrules.com >> www.learningjquery.com >> >> >> >> >> On Jul 4, 2008, at 10:35 PM, David Morton wrote: >> >> Yes, I think I can, now that I can use the local element concept. I was >> afraid before that I'd have to have a $('something').cluetip("dynamic") line >> for every row - and since that data is dynamic, I couldn't reference another >> file. >> >> Is this the proper place to ask for feature enhancements for cluetip? I >> like the idea of having a cluetip element automatically look for another >> element locally, but it is a slight abuse of html attributes. One example >> is the "rel" attribute for "a" elements - it's not really supposed to be >> used to reference another class... >> >> Also, since not everything that needs a tip is an anchor, I'm using >> "label" elements and "for" attributes for some of my cluetips, but it breaks >> the validation a little as the "for" attribute cannot start with a "." or >> "#". >> >> So.. a couple of ways around it, if cluetip could be made to follow... >> >> Have an option for the cluetip call that tells it to assume a "." in front >> of the class name attribute, which would let the text validate, or an option >> to assume the tooltip text is in an element with an id the same as the >> anchor plus a prefix or suffix. ie, >> >> <p class="MyTooltips" id="something">blah blah</p> >> <span id="cluetip_something">Here's the text of the tooltip</span> >> >> $('.MyTooltips').cluetip({ useids: true }); >> >> >> This gets rid of the need for the rel attribute hack. >> >> On Fri, Jul 4, 2008 at 9:02 PM, Karl Swedberg <[EMAIL PROTECTED]> >> wrote: >> >>> David, >>> Is there any way that you can just reference a separate file with your >>> script in it? That's the preferred way. You can then put <script >>> src="yourfilename.js"></script> in the head of your document. Then in >>> yourfilename.js, you put the cluetip line inside a document ready: >>> >>> $(document).ready(function() { >>> $('whatever').cluetip(); >>> }); >>> >>> You won't have to worry about any of this stuff then, and you can keep >>> the behavior separate from the content. >>> >>> >>> --Karl >>> ____________ >>> Karl Swedberg >>> www.englishrules.com >>> www.learningjquery.com >>> >>> >>> >>> >>> On Jul 4, 2008, at 8:01 PM, David Morton wrote: >>> >>> wait, that still doesn't quite explain it all... >>> >>> The other way I tried it was to have a span right after the link that >>> contain the tooltip text, with a class matching the rel link in the anchor. >>> Then I called the script to load local after the table, after the form >>> actually. >>> >>> On Fri, Jul 4, 2008 at 6:41 PM, David Morton <[EMAIL PROTECTED]> wrote: >>> >>>> erg. The data is available in a loop while in the table... I'll have to >>>> loop again to output the javascript. Drat that IE stuff. >>>> >>>> I'll give it a shot. Maybe I can capture the javascript string in >>>> variable as I loop and then output it later. >>>> >>>> I have tried to get rid of the tables altogether, but seeing as how it >>>> is rows and columns of data, it's some pretty hard CSS to make it work. >>>> >>>> Thanks for the help! >>>> >>>> >>>> On Fri, Jul 4, 2008 at 12:47 PM, Karl Swedberg <[EMAIL PROTECTED]> >>>> wrote: >>>> >>>>> Hi David, >>>>> Seems that IE does not like the script being executed from within a >>>>> table cell. If you move the scripts out of the body and put them in the >>>>> <head> or in a separate file (and make sure you're calling cluetip from >>>>> within a document ready), it should work. I had to clear my cache before >>>>> IE >>>>> would work again after making the changes, but that did the trick. >>>>> >>>>> Here is an example, with the table rows copied and pasted from your >>>>> email: >>>>> >>>>> http://test.learningjquery.com/cluetip/demo/table.html >>>>> >>>>> Actually, putting the scripts after the table in the body works too. >>>>> The ways of IE are mysterious. >>>>> >>>>> --Karl >>>>> ____________ >>>>> Karl Swedberg >>>>> www.englishrules.com >>>>> www.learningjquery.com >>>>> >>>>> >>>>> >>>>> >>>>> On Jul 4, 2008, at 12:24 PM, David Morton wrote: >>>>> >>>>> I even changed it to just have the tip in the call: >>>>> >>>>> <tr class="hambody" id="row_529806"><td align="left"> >>>>> >>>>> <a id="link_529806" class="thickbox tip" rel=".tip_529806" >>>>> href="view.php?mail_id=529806&cache_type=ham&address_id=6">two</a> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> <script type="text/javascript">$("#link_529806").cluetip("two");</script> >>>>> >>>>> </td></tr> >>>>> <tr class="hambody_alt" id="row_550060"><td align="left"> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> <a id="link_550060" class="thickbox tip" rel=".tip_550060" >>>>> href="view.php?mail_id=550060&cache_type=ham&address_id=6">three</a> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> <script >>>>> type="text/javascript">$("#link_550060").cluetip("three");</script> >>>>> >>>>> </td></tr> >>>>> >>>>> And that crashes. >>>>> >>>>> >>>>>> >>>>>> On Fri, Jul 4, 2008 at 10:42 AM, Karl Swedberg <[EMAIL PROTECTED]> >>>>>> wrote: >>>>>> >>>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> I can't tell from the information what is causing the problem, but if >>>>>>> I had to guess, I'd suggest looking at the content that is being loaded. >>>>>>> I've seen problems before when invalid markup, usually caused by >>>>>>> unclosed >>>>>>> tags, is inserted into the cluetip. Not sure if this is the problem >>>>>>> here, >>>>>>> but maybe it's a place to start. >>>>>>> >>>>>>> --Karl >>>>>>> ____________ >>>>>>> Karl Swedberg >>>>>>> www.englishrules.com >>>>>>> www.learningjquery.com >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Jul 3, 2008, at 11:23 PM, dgm wrote: >>>>>>> >>>>>>> >>>>>>>> I'm trying to use cluetip (Looks great!) to display a full text of >>>>>>>> otherwise truncated data, in a table. (Email subjects are truncated >>>>>>>> for the normal view, but if you mouse over, I want a tooltip to show >>>>>>>> the full subject). I'm using php and smarty templates to generate >>>>>>>> the >>>>>>>> table rows: >>>>>>>> >>>>>>>> <td align="left"> >>>>>>>> <a id="link_{$row[hamloop].id}" class="thickbox tip" >>>>>>>> rel=".tip{$row[hamloop].id}" >>>>>>>> >>>>>>>> href="view.php{$msid}mail_id={$row[hamloop].id}&cache_type={$cache_type}&address_id={$row[hamloop].address_id}"> >>>>>>>> {$row[hamloop].subject|truncate:$truncate_subject:"...":true| >>>>>>>> escape:'htmlall'} >>>>>>>> </a> >>>>>>>> <span class="tip{$row[hamloop].id}">{$row[hamloop].subject| >>>>>>>> escape:"javascript"|escape:'htmlall'}</span> >>>>>>>> </td> >>>>>>>> >>>>>>>> and then at the bottom of the file, I do: >>>>>>>> >>>>>>>> $('a.tip').cluetip({local:true, cursor: 'pointer'}); >>>>>>>> >>>>>>>> This works great on Firefox 3, but IE 6 and 7 just give a blank >>>>>>>> screen, or a bonk dialog that says the operation was aborted. No >>>>>>>> other info. :( >>>>>>>> >>>>>>>> If I take out the cluetip call, it loads ok. >>>>>>>> >>>>>>>> Example output from the code above: >>>>>>>> >>>>>>>> <td align="left"> >>>>>>>> <a id="link_12345" class="thickbox tip" rel=".tip12345" >>>>>>>> href="view.php? >>>>>>>> mail_id=12345&cache_type=spam&address_id=10"> >>>>>>>> A really long subject line... >>>>>>>> </a> >>>>>>>> <span class="tip12345">A really long subject line was >>>>>>>> truncated</span> >>>>>>>> </td> >>>>>>>> >>>>>>>> As I understand the docs, the <a rel=".tip12345" ... means it will >>>>>>>> put >>>>>>>> the <span class="tip12345" text into he tooltip. This is repeated >>>>>>>> many times with different id's, so there is still a one to one >>>>>>>> mapping >>>>>>>> of rel's to spans. >>>>>>>> >>>>>>>> Any ideas as to what is going on? >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> David Morton >>>>>> [EMAIL PROTECTED] - bulk address >>>>>> [EMAIL PROTECTED] - direct to my server >>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> David Morton >>>>> [EMAIL PROTECTED] - bulk address >>>>> [EMAIL PROTECTED] - direct to my server >>>>> >>>>> >>>>> >>>> >>>> >>>> -- >>>> David Morton >>>> [EMAIL PROTECTED] - bulk address >>>> [EMAIL PROTECTED] - direct to my server >>>> >>> >>> >>> >>> -- >>> David Morton >>> [EMAIL PROTECTED] - bulk address >>> [EMAIL PROTECTED] - direct to my server >>> >>> >>> >> >> >> -- >> David Morton >> [EMAIL PROTECTED] - bulk address >> [EMAIL PROTECTED] - direct to my server >> >> >> > > > -- > David Morton > [EMAIL PROTECTED] - bulk address > [EMAIL PROTECTED] - direct to my server > -- David Morton [EMAIL PROTECTED] - bulk address [EMAIL PROTECTED] - direct to my server
cluetip-autoid.diff
Description: Binary data