Spaces:
Running
Running
the heading text dont work and adfd social media
Browse files- index.html +3 -33
index.html
CHANGED
|
@@ -140,7 +140,7 @@
|
|
| 140 |
</div>
|
| 141 |
<!-- Editable Name -->
|
| 142 |
<div class="relative mb-3">
|
| 143 |
-
<h1 id="editableName" class="text-3xl font-bold gradient-text text-center min-h-[1.5em] px-2 py-1 rounded" contenteditable="true" data-placeholder="Tap to Add your Name"
|
| 144 |
</div>
|
| 145 |
<!-- Contact Button -->
|
| 146 |
<div class="relative mb-4 w-3/5 mx-auto">
|
|
@@ -306,7 +306,7 @@
|
|
| 306 |
});
|
| 307 |
});
|
| 308 |
});
|
| 309 |
-
// Initialize placeholder functionality
|
| 310 |
document.querySelectorAll('.editable').forEach(editable => {
|
| 311 |
// Clear placeholder text when focusing
|
| 312 |
editable.addEventListener('focus', function() {
|
|
@@ -319,36 +319,11 @@
|
|
| 319 |
// Restore placeholder if empty when blurring
|
| 320 |
editable.addEventListener('blur', function() {
|
| 321 |
if (this.textContent.trim() === '') {
|
| 322 |
-
this.textContent = '';
|
| 323 |
}
|
| 324 |
this.style.background = 'transparent';
|
| 325 |
});
|
| 326 |
});
|
| 327 |
-
// Fix for heading text visibility - replace with new element
|
| 328 |
-
const nameElement = document.getElementById('editableName');
|
| 329 |
-
const newNameElement = document.createElement('h1');
|
| 330 |
-
newNameElement.id = 'editableName';
|
| 331 |
-
newNameElement.className = 'text-3xl font-bold mb-3 gradient-text editable';
|
| 332 |
-
newNameElement.contentEditable = 'true';
|
| 333 |
-
newNameElement.setAttribute('data-placeholder', 'Tap to Add your Name');
|
| 334 |
-
newNameElement.textContent = nameElement.textContent;
|
| 335 |
-
|
| 336 |
-
nameElement.parentNode.replaceChild(newNameElement, nameElement);
|
| 337 |
-
|
| 338 |
-
// Reinitialize event listeners for the new element
|
| 339 |
-
newNameElement.addEventListener('focus', function() {
|
| 340 |
-
if (this.textContent === this.getAttribute('data-placeholder')) {
|
| 341 |
-
this.textContent = '';
|
| 342 |
-
}
|
| 343 |
-
this.style.background = 'transparent';
|
| 344 |
-
});
|
| 345 |
-
|
| 346 |
-
newNameElement.addEventListener('blur', function() {
|
| 347 |
-
if (this.textContent.trim() === '') {
|
| 348 |
-
this.textContent = '';
|
| 349 |
-
}
|
| 350 |
-
this.style.background = 'transparent';
|
| 351 |
-
});
|
| 352 |
function addSocialIcon(platform, handle) {
|
| 353 |
const container = document.getElementById('socialIconsContainer');
|
| 354 |
|
|
@@ -451,8 +426,6 @@ function getSocialUrl(platform, handle) {
|
|
| 451 |
// Set content only if it's not empty or placeholder
|
| 452 |
if (profileData.name && profileData.name !== 'Tap to Add your Name') {
|
| 453 |
document.getElementById('editableName').textContent = profileData.name;
|
| 454 |
-
} else {
|
| 455 |
-
document.getElementById('editableName').textContent = 'Tap to Add your Name';
|
| 456 |
}
|
| 457 |
|
| 458 |
if (profileData.title && profileData.title !== 'Tap to Add your Title') {
|
|
@@ -468,9 +441,6 @@ function getSocialUrl(platform, handle) {
|
|
| 468 |
if (profileData.image && profileData.image !== 'http://static.photos/technology/320x240/42') {
|
| 469 |
document.getElementById('profileImage').src = profileData.image;
|
| 470 |
}
|
| 471 |
-
} else {
|
| 472 |
-
// Initialize with placeholder
|
| 473 |
-
document.getElementById('editableName').textContent = 'Tap to Add your Name';
|
| 474 |
}
|
| 475 |
</script>
|
| 476 |
</body>
|
|
|
|
| 140 |
</div>
|
| 141 |
<!-- Editable Name -->
|
| 142 |
<div class="relative mb-3">
|
| 143 |
+
<h1 id="editableName" class="text-3xl font-bold gradient-text text-center min-h-[1.5em] px-2 py-1 rounded editable" contenteditable="true" data-placeholder="Tap to Add your Name">Tap to Add your Name</h1>
|
| 144 |
</div>
|
| 145 |
<!-- Contact Button -->
|
| 146 |
<div class="relative mb-4 w-3/5 mx-auto">
|
|
|
|
| 306 |
});
|
| 307 |
});
|
| 308 |
});
|
| 309 |
+
// Initialize placeholder functionality
|
| 310 |
document.querySelectorAll('.editable').forEach(editable => {
|
| 311 |
// Clear placeholder text when focusing
|
| 312 |
editable.addEventListener('focus', function() {
|
|
|
|
| 319 |
// Restore placeholder if empty when blurring
|
| 320 |
editable.addEventListener('blur', function() {
|
| 321 |
if (this.textContent.trim() === '') {
|
| 322 |
+
this.textContent = this.getAttribute('data-placeholder');
|
| 323 |
}
|
| 324 |
this.style.background = 'transparent';
|
| 325 |
});
|
| 326 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 327 |
function addSocialIcon(platform, handle) {
|
| 328 |
const container = document.getElementById('socialIconsContainer');
|
| 329 |
|
|
|
|
| 426 |
// Set content only if it's not empty or placeholder
|
| 427 |
if (profileData.name && profileData.name !== 'Tap to Add your Name') {
|
| 428 |
document.getElementById('editableName').textContent = profileData.name;
|
|
|
|
|
|
|
| 429 |
}
|
| 430 |
|
| 431 |
if (profileData.title && profileData.title !== 'Tap to Add your Title') {
|
|
|
|
| 441 |
if (profileData.image && profileData.image !== 'http://static.photos/technology/320x240/42') {
|
| 442 |
document.getElementById('profileImage').src = profileData.image;
|
| 443 |
}
|
|
|
|
|
|
|
|
|
|
| 444 |
}
|
| 445 |
</script>
|
| 446 |
</body>
|