最近の検索


最近の検索はありません

Nico Bruning's Avatar

Nico Bruning

参加日2023年11月30日

·

前回のアクティビティ2024年1月18日

フォロー中

0

フォロワー

0

合計アクティビティ

9

投票

2

受信登録

3

アクティビティの概要

さんの最近のアクティビティ Nico Bruning

Nico Bruningさんがコメントを作成しました:

コミュニティのコメント Discussion - Tips and best practices from the community

Matt Farrington Smith cool that you like it.
The basic idea came from this: https://codepen.io/leetech/pen/dOOgBx 

If you want to change the speed, look for the 

setInterval(typeIt, 100)

function. The second parameter is the time in Milliseconds.

You could introduce a const for the typing speed like

const typingSpeed = 100 //change this number to your liking

 just at the top, where the other consts are introduced and then change the function to

setInterval(typeIt, typingSpeed)

This way you can change the speed from a central place and you and your colleagues can improve the readability. 

Hope this helps.

コメントを表示 · 投稿日時:2024年1月18日 · Nico Bruning

0

フォロワー

0

投票

0

コメント


Nico Bruningさんが投稿を作成しました:

投稿 Discussion - Tips and best practices from the community

What we wanted to achieve: When users land on our zendesk homepage the focus should lie on the search field. Sometimes you do not exactly know what you can search for. In our searchbar we wanted users to get suggestions for useful search questions. To make it extra fancy those suggestions should have a typewriter effect to appear as being typed out in real time.

What you need: a little bit of time and ideally dynamic content enabled, but you could also hardcode the placeholders if you don't use multi language support. 

 

How to do it: If you want to use dynamic content for the placeholders, you should create those  first (Admin Center -> Agent Tools -> Dynamic Content).

We created three different placeholders and named them search placeholder 1/2/3 so we can use them with the dynamic content helper like

{{dc 'search_placeholder_1')

 

If you are not using dynamic content you can skip step 1.

1.

In your document_head.hbs add the following lines after the first tag:



 

2.

Now for the cool stuff add the following lines at the end of your script.js file:

window.addEventListener("load", () => {
const search = document.querySelector("input[type='search']");
const searchForm = document.querySelector("form.search-full");
const defaultPlaceholder = search.getAttribute('placeholder');
const placeholderElements = [
document.querySelector('meta[name="search-placeholder-one"]'),
document.querySelector('meta[name="search-placeholder-two"]'),
document.querySelector('meta[name="search-placeholder-three"]')
];
const placeholders= placeholderElements
.map(element => element ? element.getAttribute('content') : null)
.filter(content => content !== null);

let currentPlaceholderIndex = 0;
let currentPlaceholderCharacter = 0;
let interval;
const delayBetweenPlaceholders = 1000;

if (searchForm) {
search.focus();
search.setAttribute('placeholder', '');

let typeIt = function() {
currentPlaceholderCharacter++;
let typedOut = placeholders[currentPlaceholderIndex].substring(0, currentPlaceholderCharacter);
search.setAttribute('placeholder', typedOut);

if (currentPlaceholderCharacter === placeholders[currentPlaceholderIndex].length) {
currentPlaceholderCharacter = 0;
currentPlaceholderIndex++;

if (currentPlaceholderIndex >= placeholders.length) {
setTimeout(function() {
search.setAttribute('placeholder', defaultPlaceholder);
}, delayBetweenPlaceholders);

clearInterval(interval);
} else {
// If not last placeholder, stop the current interval and set a new one after a delay.
clearInterval(interval);
setTimeout(function() {
interval = setInterval(typeIt, 100);
}, delayBetweenPlaceholders);
}
}
};
// Start typing the placeholders.
interval = setInterval(typeIt, 100);
}
});

 Again, if you do not use dynamic content you can delete this part

const placeholderElements = [
document.querySelector('meta[name="search-placeholder-one"]'),
document.querySelector('meta[name="search-placeholder-two"]'),
document.querySelector('meta[name="search-placeholder-three"]')
];
const placeholders= placeholderElements
.map(element => element ? element.getAttribute('content') : null)
.filter(content => content !== null);

and just use hardcoded strings as placeholders instead:

const placeholders = [
"This will be typed out first",
"This placeholder will be typed second",
"And this at last",
];
 And that's it. Check your live preview and see the magic happen :)     
     

編集日時:2024年1月03日 · Nico Bruning

3

フォロワー

5

投票

4

コメント


Nico Bruningさんがコメントを作成しました:

コミュニティのコメント Discussion - Tips and best practices from the community

Hi, does anyone know if it is possible to overwrite the translations for 'content_tags_label' ?

'Related to' in english might be fine, but the german translation 'Verknüpfung mit' is not really nice and instantly understandable for the reader. But this translation is not included in the manifest.json

コメントを表示 · 投稿日時:2023年11月30日 · Nico Bruning

0

フォロワー

0

投票

0

コメント


Nico Bruningさんがコメントを作成しました:

コメントArbeiten mit Beiträgen in der Wissensdatenbank

Is it possible to overwrite the translations for 'content_label_tag' ?

'Related to' in english might be fine, but the german translation 'Verknüpfung mit' is not really nice and instantly understandable for the reader.

コメントを表示 · 編集日時:2023年11月30日 · Nico Bruning

0

フォロワー

0

投票

0

コメント