Skip to content

Commit d4528a1

Browse files
committed
XKCD: Use tooltip for alt text
1 parent 9ab6c59 commit d4528a1

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/components/Widgets/XkcdComic.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<template>
2-
<div class="xkcd-wrapper">
2+
<div class="xkcd-wrapper" v-tooltip="toolTip(alt)">
33
<h3 class="xkcd-title">{{ title }}</h3>
44
<a :href="`https://xkcd.com/${comicNum}/`">
5-
<img :src="image" :alt="alt" class="xkcd-comic" />
5+
<img :src="image" :alt="alt" class="xkcd-comic"/>
66
</a>
77
</div>
88
</template>
@@ -59,6 +59,12 @@ export default {
5959
this.alt = data.alt;
6060
this.comicNum = data.num;
6161
},
62+
toolTip(alt) {
63+
const content = alt;
64+
return {
65+
content, html: false, trigger: 'hover focus', delay: 250, classes: 'xkcd-alt-tt',
66+
};
67+
},
6268
},
6369
};
6470
</script>
@@ -80,3 +86,8 @@ export default {
8086
}
8187
8288
</style>
89+
<style lang="scss">
90+
.xkcd-alt-tt {
91+
min-width: 20rem;
92+
}
93+
</style>

0 commit comments

Comments
 (0)