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
|
// portfolio-index rows are real links (data-img + href together) — a
|
||||||
// single click there used to jump straight into the project, which
|
// single click there used to jump straight into the project, which
|
||||||
// meant hovering was the only way to preview a different one first.
|
// meant hovering was the only way to preview a different one first.
|
||||||
// now the first click just locks it (no navigation); only a second
|
// now a click just locks/unlocks it like any other row; the preview
|
||||||
// click on the already-locked row, or the preview image itself,
|
// image is the dedicated way to actually navigate in.
|
||||||
// actually navigates.
|
|
||||||
var isProjectLink = a.hasAttribute("href") && a.hasAttribute("data-img");
|
var isProjectLink = a.hasAttribute("href") && a.hasAttribute("data-img");
|
||||||
a.addEventListener("mouseenter", function () {
|
a.addEventListener("mouseenter", function () {
|
||||||
if (locked < 0) { hidePeek(); render(i); } // nothing locked — hover drives the main preview, like before locking existed
|
if (locked < 0) { hidePeek(); render(i); } // nothing locked — hover drives the main preview, like before locking existed
|
||||||
@@ -115,16 +114,9 @@
|
|||||||
else hidePeek();
|
else hidePeek();
|
||||||
});
|
});
|
||||||
a.addEventListener("click", function (e) {
|
a.addEventListener("click", function (e) {
|
||||||
if (isProjectLink) {
|
if (isProjectLink) e.preventDefault(); // never navigate from the row itself
|
||||||
if (locked === i) return; // already locked — let the link through
|
else if (a.getAttribute("href")) return; // ".." navigates normally
|
||||||
e.preventDefault();
|
else e.preventDefault();
|
||||||
lock(i);
|
|
||||||
render(i, true);
|
|
||||||
hidePeek();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (a.getAttribute("href")) return; // ".." navigates normally
|
|
||||||
e.preventDefault();
|
|
||||||
if (locked === i) { unlock(); ghostClear(); }
|
if (locked === i) { unlock(); ghostClear(); }
|
||||||
else { lock(i); render(i, true); }
|
else { lock(i); render(i, true); }
|
||||||
hidePeek();
|
hidePeek();
|
||||||
|
|||||||
Reference in New Issue
Block a user