1

If you notice there is no anchors when you load the page :

http://alvarotrigo.com/multiScroll/

but if you scroll down and up again :

/multiScroll/#first appears.

I need ' #first ' on first page load not when I scroll so I can use afterLoad function on page load.

Fiddle https://jsfiddle.net/oadfcjt2/8/

$('#myContainer').multiscroll({

sectionsColor: ['#1bbc9b', '#4BBFC3', '#7BAABE'],
menu: false,
afterLoad: function(anchorLink, index){
    if(index == 1){
        alert("first");
    }
}
});

Any help?Thank you.

MatthewD
  • 6,719
  • 5
  • 22
  • 41
albert
  • 25
  • 5

1 Answers1

1

Use the afterRender callback for it.

$('#myContainer').multiscroll({

    sectionsColor: ['#1bbc9b', '#4BBFC3', '#7BAABE'],
    menu: false,
    afterLoad: function (anchorLink, index) {
        afterLoadActions(anchorLink, index);
    },
    afterRender: function () {
        var activeSection = $('.ms-left').find('.ms-section.active');
        var activeAnchor = activeSection.data('anchor');

        afterLoadActions(activeAnchor, activeSection.index());
    }
});


function afterLoadActions(anchorLink, index) {
    if (index == 1) {
        alert("first");
    }
}
Alvaro
  • 40,778
  • 30
  • 164
  • 336
  • Hello alvaro,thank you for your response.I tried but it doesn't work for me. – albert Oct 01 '15 at 18:43
  • I added this line "var activeSection = $('.ms-right').find('.ms-section.active');" to your code and now works good.Thank you so much for your time. – albert Oct 02 '15 at 15:10