From 746a6ada8ac73fa9cf338ac986178601eaf775d5 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Sat, 13 Feb 2016 11:46:42 +0800 Subject: [PATCH] Add click listener to correct fn-item Or there will be multiple listener on a fn-item, which causes racing when clicking an item. It prevents scrolling and some other strange behaviors when I have 10+ posts. --- assets/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/index.js b/assets/js/index.js index 056a1bd..3b513fd 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -49,7 +49,7 @@ var $sitehead = $('#site-head'); var index = $(this).parents('.post-holder').index(); $fnav.append(""+t+"") $(this).parents('article').attr('id',t.toLowerCase().split(' ').join('-')); - $('.fn-item').click(function () { + $('.fn-item').last().click(function () { var i = $(this).attr('item_index'); var s = $(".post[item_index='"+i+"']");