Skip to main content

Ralsina.Me — Roberto Alsina's website

My Solution For Bootstrap's Freaking Fixed Navigation Bar Hiding Things

This is a well known prob­lem with boot­strap:

If you use a fixed nav­i­ga­tion bar at the top, when­ev­er you fol­low a link to some­where in­side the page, the ac­tu­al link tar­get is go­ing to be hid­den be­low that freak­ing nav­i­ga­tion bar.

There are a ton of so­lu­tion­s, which have two tons of mi­nor is­sues. There seems to be no way to solve this us­ing CSS and JS with­out caus­ing oth­er prob­lem­s.

There are a bunch of JS so­lu­tions around. Here's mine:

<script type="text/javascript">
 $(window).on('hashchange', function(){
     if (location.hash) {
         $('body').animate({scrollTop: $(location.hash).offset().top - $('#navbar').outerHeight(true)*1.2 }, 1);
     }
 });
 $(document).ready(function(){$(window).trigger('hashchange')});
 </script>

It works well, is short and has de­cent brows­er cov­er­age. It on­ly fails in the cor­ner case of click­ing on the same in­ter­nal link twice (which, who cares).

Am I a Dickhead? You be the judge.

For some rea­son to­day I got in­to a lit­tle spat with Zed Shaw which end­ed with me blocked af­ter a bar­rage of ver­bal abuse.

So, he says I am a dick­head. Is it so? Here's the ex­change in an im­age, and here it is on twit­ter:

/galleries/random/zed-being-zed.png

It seems to me it's most­ly a case of some­one be­ing quick to dish abuse but slow to ac­cept dis­agree­men­t. But hey, maybe I am a dick­head for say­ing that. That con­ver­sa­tion had a few oth­er branch­es, but those were dis­agree­ments about the top­ic (in which, I have to say, Zed is com­plete­ly clue­less, and wrong, al­though IANAL) Find­ing them all may be too much ef­fort but here's one

New Nikola Galleries

One of the re­quire­ments I had for Niko­la my stat­ic site/blog gen­er­a­tor, was that it should build im­age gal­leries. And that it should show the im­ages sort­ed by date, and that it should be func­tion­al and nice.

Well, the nice part has been lack­ing for a long time. But I think I have a grasp on it now.

Here's be­fore:

Read more…

New project: Nikola Event Kit

The Python Ar­genti­na group or­ga­nizes lots of events. Like, half a dozen ev­ery year, or more. Those in­clude mul­ti­-­day events like Py­Cam­p, larg­er con­fer­ences like Py­Con, and sev­er­al Py­Days.

Py­Days are spe­cial, they are usu­al­ly sin­gle-­track, just one day (ob­vi­ous­ly), free, and or­ga­nized at uni­ver­si­ties, for stu­dents, and of­ten by stu­dents. And one stum­bling block is usu­al­ly how to set­up the web in­fra­struc­ture for one. There is a we­b2py app cre­at­ed by Mar­i­ano Rein­gart, but I feel it's overkil­l. Al­so, set­ting up host­ing, databas­es, cus­tomiza­tion­s, etc. is a lot of work!

So, I de­cid­ed, prod­ded by Juan Ro­driguez Mon­ti, to see how much can be done with­out set­ting up com­plex things. And I think it's quite a lot. Based on Niko­la my stat­ic site gen­er­a­tor, I cre­at­ed a tem­plate site for small events, like Py­Days, called Niko­la Event Kit

The goal is that you should be able to set­up ba­sic con­tent, signup for­m, sched­ule, and the ob­vi­ous need­ed things in one day. And then you can al­lo­cate an­oth­er day or more for cus­tomiz­ing the look of the site.

And then you are done, no need to de­ploy any­thing oth­er than plain HTM­L.

If you want to test-­drive it, here's a de­mo site and here is the code ready for you to fork in­to your own even­t's site.

Have fun!


Contents © 2000-2020 Roberto Alsina