RE:

<span macro='tiddler TableHighlight'></span>

A penny just dropped! I have a TW with <<tiddler tiddlerScripts>> in
all the tiddlers. I knew there was a simple way. "Come in!", as the
kids at Alsager Comprehensive School used to say.

This is the kind of thing that should be saved. Its a valuable
question with an excellent answer which goes further than answering
the initial question. It illuminates something else.

@Mike, is that example from the Javascript Missing Manual?


Alex



2009/7/13 Eric Shulman <[email protected]>:
>
>> <script>
> ...
>> (function($) {
>> $(document).ready(function( ) {
>>         $('table.sortable tbody tr').mouseover(function(){
> ...
>>         });
>>         $('table.sortable tbody tr').mouseout(function(){
> ...
>>         })});
>> })(jQuery);
>> </script>
>
> It seems that the intent of your script is to use jQuery selectors,
> e.g., $('table.sortable tbody tr'), to add mouseover/mouseout handlers
> to any table row elements of specific tiddler content, each time that
> tiddler is displayed.  If this is the case, then the use of "$
> (document).ready(...)" is not correct here.  That function is used to
> register a 'callback' handler that is invoked when the document is
> initially loaded... an event that occurs just once, *prior* to any
> TiddlyWiki code being invoked (not even the TW core!), and long before
> any inline script can be applied to *rendered* tiddler content.
>
> Try this simplified [[TableHighlight]] code structure:
>
> <script>
> jQuery('table.sortable tbody tr').mouseover(function(){ ... });
> jQuery('table.sortable tbody tr').mouseout(function(){ ... });
> jQuery('table.twtable tbody tr').mouseover(function(){ ... });
> jQuery('table.twtable tbody tr').mouseout(function(){ ... });
> </script>
>
> Then, to invoke this script, just place
>   <<tiddler TableHighlight>>
> at the end of any desired tiddler content.  Or... if you want to apply
> the script to *every* tiddler, add the following at the end of the
> [[ViewTemplate]]:
>   <span macro='tiddler TableHighlight'></span>
>
> enjoy,
> -e
> Eric Shulman
> TiddlyTools / ELS Design Studios
> >
>



-- 
http://www.multiurl.com/g/64

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/TiddlyWiki?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to