emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] collapsing some headings on html export?


From: Daniel Clemente
Subject: Re: [O] collapsing some headings on html export?
Date: Fri, 26 Aug 2011 18:04:16 +0200
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.8 Emacs/24.0.50 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

El Fri, 26 Aug 2011 09:41:38 -0400 Matt Price va escriure:
> 
> On Fri, Aug 26, 2011 at 4:58 AM, Daniel Clemente <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]