fniessen / org-html-themes

Transform your Org mode files into stunning HTML documents in minutes with our Org mode HTML theme. Elevate your productivity and impress your readers! #orgmode #html #theme #productivity #design
GNU General Public License v3.0
2.22k stars 435 forks source link

Fix clicking on toc entries for readtheorg #142

Closed alejandrogallo closed 2 years ago

alejandrogallo commented 2 years ago

I guess this was a typo that did not get corrected!

fniessen commented 2 years ago

@alejandrogallo , thanks for this fix. However, I'm not aware of any problem. Could you describe what's expected, and what you get, without this patch?

Then, I'd apply it with pleasure!

Best regards...

alejandrogallo commented 2 years ago

Hi! well, if you open the inspector and click on a link of the toc then you get an error message saying that the variable nav_li_el is not found. Indeed in the js there is no such variable. I did some other changes, like for instance instead of a whole function for the activating of the ul's. At least in my testing with the current implementation when I click on a link on the toc then you'd have to click on it again so that it gets closed. I thought the intended behaviour should be that one fold opens and the rest close, which whould rather be done like this:

$(document).ready(function() {
    // these kids and their javascript...
    $("#text-table-of-contents a").click(function() {
        $("#text-table-of-contents a")
            .map((idx, a) => $(a).parent().removeClass("active"));
        $(this).parent().toggleClass("active");
    });
});

But I'm not sure this is the intended behaviour.

fniessen commented 2 years ago

Dear @alejandrogallo , thanks for the fix!