javascript - Arrows navigation based on which section are you in -
does know if there exists plugin or similar achieve navigation on website: http://discover.store.sony.com/tablet/#entertainment
i talking , down arrows appear when hovering on top pr bottom part of screen.
in theory, shouldn't difficult write yourself. here's starting point achieve arrows when hovering on parts of page. need handle attaching specific links arrows depending on section user looking at.
see comments more details.
note in fiddle have used event.pagex
, event.pagey
current mouse position, in reality should use event.screenx
, event.screeny
. because demo in fiddle embedded small window actual page, using latter not work.
// define how wide areas should // arrow appears var top_nav_height = 70; var bottom_nav_height = 70; // dimensions var page_height = $(document).height(); var half_arrow_size = $('.uparrow').width() / 2; // listen user moving mouse $(document).mousemove(function(event) { // mouse? var pos_y = event.screeny; // distance top of page var pos_x = event.screenx; // distance left of page var in_area; // leave 5px space hide arrows when // pointer moves outside of page if (pos_y <= top_nav_height && pos_y > 5) { in_area = 'top_nav'; } else if (page_height - pos_y <= bottom_nav_height && page_height - pos_y > 5) { in_area = 'bottom_nav'; } // show arrow when in nav area switch(in_area) { // in top nav area case 'top_nav': // show .uparrow , have follow mouse $('.uparrow') .show() .css({ top: pos_y - half_arrow_size, left: pos_x - half_arrow_size }); break; // in bottom nav area case 'bottom_nav': // show .bottomarrow , have follow mouse $('.bottomarrow') .show() .css({ top: pos_y - half_arrow_size, left: pos_x - half_arrow_size }); break; // aren't in nav area default: // hide both arrows $('.uparrow, .bottomarrow').hide(); } // decide arrow should link });
to handle links, guess have separate set of arrows on each section of page, targets link can pretty hardcoded.
Comments
Post a Comment