Reputation: 53
For a project I'm currently working on am trying to reach the following:
I have a simple page, on this page are 4, hidden and not visible elements, they are simply formatted as this:
<a href="#" class="link_1"></a>
<a href="#" class="link_2"></a>
<a href="#" class="link_3"></a>
<a href="#" class="link_4"></a>
Basically all i want, is too build a sort of Easter egg, so when a user clicks these buttons in a specific order, i.e. link_4 -> link_1 -> link_3 -> link_2 it triggers a certain event, whatever this might be.
Ofcourse the event could only be triggered if the right combination/order of clicks have been done.
Any ideas how to go about this using jQuery?
Upvotes: 5
Views: 152
Reputation: 1275
var click_order = [];
$('a').click(function (e) {
click_order.push($(this).index());
if (click_order.slice(-4) == '3,0,2,1') {
// easter egg stuff
}
});
Upvotes: 8