Support » Plugin: Page scroll to id » js used for making entire div clickable

  • Hi I’m using custom js to make an entire div clickable, and smooth scroll is no longer occurring. Is there something I should add to the script to re-enable smooth scrolling?

    ie.

    jQuery(function($) {
    $(‘#MY_SECTION_ID’).click(function() {
    window.location.href = ‘#NEXT_DIV’;
    }
    });

Viewing 1 replies (of 1 total)
  • Plugin Author malihu

    (@malihu)

    Hi,

    The plugin works out-of-the-box only on link (anchor) elements (<a />) with a valid href attribute.

    If you want to make the div scroll smoothly to an id (when clicked), you should use plugin’s scrollTo method in your script. For example:

    $("#MY_SECTION_ID").click(function(e) {
        e.preventDefault();
        $.mPageScroll2id("scrollTo","#NEXT_DIV");
    }
    

    The method provides few options like special offset, clicked element etc. (more info).

    • This reply was modified 1 year, 1 month ago by  malihu.
Viewing 1 replies (of 1 total)
  • The topic ‘js used for making entire div clickable’ is closed to new replies.