Commit b7c689a1 authored by gijs's avatar gijs
Browse files

Style changes, preventing routing on jump links in about page.

parent c3224743
......@@ -109,7 +109,7 @@ a {
text-decoration: none;
}
a:hover {
a[href]:hover {
color: var(--background-color);
filter: brightness(200%);
}
......@@ -1936,6 +1936,11 @@ ol[data-alternative]:before {
.page .body-text h1 {
margin-left: -1.2rem;
margin-bottom: calc(.5 * var(--line-height));
font-size: 110%;
}
h1:not(:first-child) {
margin-top: calc(1.25 * var(--line-height));
}
.page .body-text h2 {
......@@ -1944,19 +1949,25 @@ ol[data-alternative]:before {
display: inline-block;
color: var(--background-color);
margin-top: calc(.75 * var(--line-height));
margin-bottom: calc(.25 * var(--line-height));
margin-bottom: calc(.5 * var(--line-height));
padding: .15rem .2rem 0 .2rem;
}
.page .body-text h1 + h2 {
margin-top: 0;
}
.body-text--about :matches(p) + :matches(p) { margin-top: calc(0.8 * var(--line-height)); }
.body-text--about {
max-width: 60em;
max-width: 75em;
}
.body-text--about .is-en,
.body-text--about .is-fr {
[lang="fr"] .body-text--about:not(.intro) .is-fr,
[lang="en"] .body-text--about:not(.intro) .is-en {
display: flex;
align-items: start;
}
.body-text--about article {
......@@ -1965,17 +1976,17 @@ ol[data-alternative]:before {
flex: 1 0;
}
.page .body-text h1 + h2 {
margin-top:0;
}
.body-text--about .toc {
width: 15em;
width: 30em;
position: -webkit-sticky;
position: sticky;
top: 0;
top: 1em;
}
:root {
--line-height: 18px;
.body-text--about a {
text-decoration: underline;
}
.body-text--about a:not([href]) {
text-decoration: none;
}
\ No newline at end of file
......@@ -45,6 +45,11 @@ window.W = window.W || {};
var router = new W.ScoreRouter({application: this});
$(document).on("click", "a", function(e) {
if (!e.target.hasAttribute('href') || e.target.getAttribute('href').startsWith('#')) {
// A link without a target: anchor created by WYSIWYG editor
// or internal link
return;
}
// Do not interfere with Backbone Paginator.
if (! e.isDefaultPrevented() && ! W.utils.is_external_link(e.target) && ! W.utils.is_anchor_link(e.target)) {
e.preventDefault(); // This is important
......
......@@ -2803,7 +2803,7 @@ window.W = window.W || {};
}
}
var tocEn = this.$el.find('.is-en h1, .is-en h2').map(function (index, el) {
var tocEn = this.$el.find('.is-en h1').map(function (index, el) {
var $header = $(el);
addId($header);
return [{
......@@ -2813,7 +2813,7 @@ window.W = window.W || {};
}];
}).get();
var tocFr = this.$el.find('.is-fr h1, .is-fr h2').map(function (index, el) {
var tocFr = this.$el.find('.is-fr h1').map(function (index, el) {
var $header = $(el);
addId($header);
return [{
......@@ -2832,7 +2832,7 @@ window.W = window.W || {};
var $tocHolderFr = $(this.$el.find('.is-fr .toc'));
_.each(tocFr, function(item) {
$tocHolderEn.append('<li data-tag="' + item.tag + '"><a data-anchor href="#' + item.id + '">' + item.label + '</a></li>')
$tocHolderFr.append('<li data-tag="' + item.tag + '"><a data-anchor href="#' + item.id + '">' + item.label + '</a></li>')
})
}
});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment