El Fri, 26 Aug 2011 09:41:38 -0400 Matt Price va escriure:
> 
> On Fri, Aug 26, 2011 at 4:58 AM, Daniel Clemente <n142...@gmail.com> wrote:
> >  I did it with this code:
> > http://www.danielclemente.com/pagina/esquemadorg.js
> > http://www.danielclemente.com/pagina/esquemadorg.css
> >
> > Demo: http://www.danielclemente.com/hacer/emacs.html
>
> ah, that's pretty cool,daniel.  any suggestions for how I might
> implement this selectively, only for certain headings or heading
> levels?  My javascript is I think even worse than my elisp...

You should start by adding jQuery to your page. Then take this code fragment:

                // handle the click event for each header
                for(var i=2;i<=7;++i) {
                        $("h"+i).each(
                                function(){
                                        $(this).css({cursor: "pointer"});
                                        $(this).bind('click', function(){ 
toggleForOrg_whenclicked( $(this).parent().children("div").eq(0) ); });
                                });
                }

It searches all h2, h3, h4, h5, h6, h7 elements. You can remove the loop and 
use another jQuery selector which finds the headers you want. They are like CSS 
selectors. For instance this should work: $("h2.myclass") or $("h2, h4")

For that code to work, you should copy at least these functions from 
esquemadorg.js: toggleForOrg_whenclicked, hideForOrg_whenclicked, 
showForOrg_whenclicked. Then add some CSS and custom behaviours.


-- Daniel

> 
> Thanks everyone for the suggestions, I am keeping them filed away for
> when I actually finish this project...
> Matt


Reply via email to