Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

full page navigation to support mobile #8

Closed
mikkokotila opened this issue Mar 12, 2019 · 4 comments
Closed

full page navigation to support mobile #8

mikkokotila opened this issue Mar 12, 2019 · 4 comments
Assignees
Labels
major-bug affects a large share of use-cases

Comments

@mikkokotila
Copy link
Contributor

Right now the full page transition takes place when scrolling with mouse wheel or clicking the dot navigation on the right side of the screen. The current code that does it is here:

<script>
( function( $ ) {
 
  $( document ).on( 'mousewheel DOMMouseScroll', function( event ) {
 
    if ( ( $( '.et_pb_side_nav' ).length === 0 ) || $( 'html, body' ).is( ':animated' ) ) return;
 
    event.preventDefault();
 
    var direction = event.originalEvent.wheelDelta || -event.originalEvent.detail;
    var $position = $( '.et_pb_side_nav' ).find( '.active' );
    var $target;
    
    if( direction < 0 ) {
      $target = $( $position ).parent().next();
    } else {
      $target = $( $position ).parent().prev();
    }
    if ( $( $target.length ) !== 0 ) {
      $( $target ).children( 'a' ).trigger( "click" );
    }
  } );
} )( jQuery );
</script>

Basically it piggy-bags on the automatically created Divi dot navigation, where each page section gets an element in the dot navigation.

We want to extend this script so when a user moves downwards on touch screen, it does the same as mouse wheel.

@mikkokotila
Copy link
Contributor Author

So I guess the question is related with $( document ).on( 'mousewheel DOMMouseScroll', function( event ) { and how can we a) add more than one DOM event here, and b) what is the specific DOM event for scrolling down by touch.

@mikkokotila
Copy link
Contributor Author

mikkokotila commented Mar 12, 2019

This working example might be useful.

EDIT: Tested on mobile, and this works as intended. So if nothing else, we can implement it modified in a way that captures the sections from Divi dot navigation as the above example does.

@mikkokotila mikkokotila added the major-bug affects a large share of use-cases label Mar 12, 2019
@pdey
Copy link
Collaborator

pdey commented Mar 22, 2019

Which file has this code - $( document ).on( 'mousewheel DOMMouseScroll', function( event ) . How do i edit this file/code ?

@mikkokotila
Copy link
Contributor Author

This is resolved now in the sense that a) much more have been learned about the way in which people interact with web content through various devices b) a promising track have been opened in terms of being able to leverage this understanding effectively. Closing here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major-bug affects a large share of use-cases
Projects
None yet
Development

No branches or pull requests

2 participants