fix: portfolio index rows can be unlocked again
clicking the already-locked row navigated (the old second-click-to-open flow), which meant there was no way back to the unlocked hover-browsing state once something got locked. row clicks now toggle lock/unlock uniformly everywhere; the preview image is the one dedicated way to actually open a project, on the index same as project pages.
This commit is contained in:
@@ -105,9 +105,8 @@
|
||||
// portfolio-index rows are real links (data-img + href together) — a
|
||||
// single click there used to jump straight into the project, which
|
||||
// meant hovering was the only way to preview a different one first.
|
||||
// now the first click just locks it (no navigation); only a second
|
||||
// click on the already-locked row, or the preview image itself,
|
||||
// actually navigates.
|
||||
// now a click just locks/unlocks it like any other row; the preview
|
||||
// image is the dedicated way to actually navigate in.
|
||||
var isProjectLink = a.hasAttribute("href") && a.hasAttribute("data-img");
|
||||
a.addEventListener("mouseenter", function () {
|
||||
if (locked < 0) { hidePeek(); render(i); } // nothing locked — hover drives the main preview, like before locking existed
|
||||
@@ -115,16 +114,9 @@
|
||||
else hidePeek();
|
||||
});
|
||||
a.addEventListener("click", function (e) {
|
||||
if (isProjectLink) {
|
||||
if (locked === i) return; // already locked — let the link through
|
||||
e.preventDefault();
|
||||
lock(i);
|
||||
render(i, true);
|
||||
hidePeek();
|
||||
return;
|
||||
}
|
||||
if (a.getAttribute("href")) return; // ".." navigates normally
|
||||
e.preventDefault();
|
||||
if (isProjectLink) e.preventDefault(); // never navigate from the row itself
|
||||
else if (a.getAttribute("href")) return; // ".." navigates normally
|
||||
else e.preventDefault();
|
||||
if (locked === i) { unlock(); ghostClear(); }
|
||||
else { lock(i); render(i, true); }
|
||||
hidePeek();
|
||||
|
||||
Reference in New Issue
Block a user