Summary Files Commits Branches @commit @diff @stats
path: root / Year 4 / Web technologies / referat / javascript
diff options
context:
space:
mode:
1 files changed, 27 insertions, 1 deletions
-rw-r--r--Year 4/Web technologies/referat/javascript/navbar-shrink.js28
diff --git a/Year 4/Web technologies/referat/javascript/navbar-shrink.js b/Year 4/Web technologies/referat/javascript/navbar-shrink.js
index 62c4b04..648ccf4 100644
--- a/Year 4/Web technologies/referat/javascript/navbar-shrink.js
+++ b/Year 4/Web technologies/referat/javascript/navbar-shrink.js
@@ -1,7 +1,8 @@
const nav = document.getElementById('contents');
+const author = document.getElementById('author');
function change_nav_names() {
- if (window.screen.width < 700) {
+ if (window.screen.width < 970) {
nav.children[0].innerText = 'Във';
nav.children[1].innerText = 'Инст';
nav.children[2].innerText = 'Арх';
@@ -15,7 +16,32 @@ function change_nav_names() {
nav.children[3].innerText = 'Виртуални хостове';
nav.children[4].innerText = 'Конфигуриране';
}
+
+ if (window.screen.width < 570) {
+ author.firstChild.innerText = '';
+ author.lastChild.classList.remove('none');
+ author.classList.add('clickable');
+ }
+ else {
+ author.firstChild.innerText = 'Камен Младенов - 0MI0800028';
+ author.lastChild.classList.add('none');
+ author.classList.remove('clickable');
+ }
}
window.addEventListener('resize', change_nav_names);
change_nav_names();
+
+author.addEventListener('click', function() {
+ if (window.screen.width >= 570) { return; }
+ if (document.getSelection().type === 'Range') { return; }
+
+ if (author.firstChild.innerText === '') {
+ author.firstChild.innerText = 'Камен Младенов 0MI0800028';
+ }
+ else {
+ author.firstChild.innerText = '';
+ }
+ author.lastChild.classList.toggle('none');
+ author.classList.toggle('clickable');
+});