From 8424c2a290cd6bd0b1a8f3bab80c0325fcc34ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Volds=C3=A6ter?= <ole.voldsater@uib.no> Date: Tue, 15 Oct 2019 10:31:12 +0200 Subject: [PATCH] =?UTF-8?q?fikk=20skikk=20p=C3=A5=20utheving=20av=20defini?= =?UTF-8?q?sjoner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Definition.vue | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/Definition.vue b/src/components/Definition.vue index 600f882d..73d9e155 100644 --- a/src/components/Definition.vue +++ b/src/components/Definition.vue @@ -1,5 +1,5 @@ <template> - <li class="definition" :id="'def' + body.id"> + <li class="definition" :ref="'def' + body.id" :id="'def' + body.id"> <ul> <li :is="element_wrapper.template" :body="element_wrapper.element" v-for="element_wrapper in template_name_added">{{element_wrapper.element}}</li> </ul> @@ -37,6 +37,13 @@ var Definition = { } }) } + }, + mounted: function()Â { + let ref = 'def' + this.body.id + if(location.hash.substring(1) == ref){ + this.$refs[ref].scrollIntoView() + this.$refs[ref].classList.add('highlighted') + } } } @@ -46,4 +53,9 @@ export default Definition li.quote { font-style: italic; } + +.highlighted { + background-color: #ddddff; + border-radius: 5px; +} </style> -- GitLab