Skip to content

Commit

Permalink
XKCD: Use tooltip for alt text
Browse files Browse the repository at this point in the history
  • Loading branch information
m42e committed Jan 7, 2023
1 parent 9ab6c59 commit d4528a1
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/components/Widgets/XkcdComic.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<div class="xkcd-wrapper">
<div class="xkcd-wrapper" v-tooltip="toolTip(alt)">
<h3 class="xkcd-title">{{ title }}</h3>
<a :href="`https://xkcd.com/${comicNum}/`">
<img :src="image" :alt="alt" class="xkcd-comic" />
<img :src="image" :alt="alt" class="xkcd-comic"/>
</a>
</div>
</template>
Expand Down Expand Up @@ -59,6 +59,12 @@ export default {
this.alt = data.alt;
this.comicNum = data.num;
},
toolTip(alt) {
const content = alt;
return {
content, html: false, trigger: 'hover focus', delay: 250, classes: 'xkcd-alt-tt',
};
},
},
};
</script>
Expand All @@ -80,3 +86,8 @@ export default {
}
</style>
<style lang="scss">
.xkcd-alt-tt {
min-width: 20rem;
}
</style>

0 comments on commit d4528a1

Please sign in to comment.