forked from laysense/laysense.cn
Keep the home title cursor on its last line
This commit is contained in:
+3
-1
@@ -3,11 +3,13 @@
|
||||
const homeHero = document.querySelector('#main-content > .hero-home');
|
||||
const homeTitle = homeHero?.querySelector('.hero-copy h1');
|
||||
if (homeTitle) {
|
||||
const lastLine = homeTitle.querySelector('.hero-accent') || homeTitle.querySelector('.hero-heading-primary') || homeTitle;
|
||||
const cursor = document.createElement('span');
|
||||
cursor.className = 'home-cursor';
|
||||
cursor.setAttribute('aria-hidden', 'true');
|
||||
cursor.textContent = '_';
|
||||
homeTitle.append(cursor);
|
||||
// A word joiner prevents a narrow line from wrapping just the cursor.
|
||||
lastLine.append('\u2060', cursor);
|
||||
}
|
||||
|
||||
const homeImage = homeHero?.querySelector('.hero-visual > img');
|
||||
|
||||
Reference in New Issue
Block a user