I
I
Ivan Manoil2014-12-16 15:14:34
JavaScript
Ivan Manoil, 2014-12-16 15:14:34

How to use waypoint.js along with handlebars.js?

Hi all! Has anyone tried to get waypointJS to work correctly after content is loaded via handlebarsJS ? i.e. we apply waypointJS to elements that are loaded via handlebarsJS. ,
the waypoint.js script needs to be run after it has loaded our handlebars.js content.
I know that the solution may be in handlebars Helpers but I don't quite understand how to use it.

I tried like this:

$.ajax({
            url:'items_site.json',
            type: "POST",
            cache: false,
            dataType: "JSON",
            statusCode: {
                404: function () {
                    $(sites).append("<span class='item_404'>Oops items not found on server. ERRoR CODE 4o4!</span>");
                }
            }
        }).done(function(items_site){
            //RUN Handlebars
            var thumb = Handlebars.compile($('#items_site').html()),
                modal = Handlebars.compile($('#modals').html());
            $(sites).append(thumb(items_site));
            $(modals).append(modal(items_site));

            //amimate modal
            some_functions(); //эта функция запускается событиях применяемые к нашим элементов после того как потрудились, в нашем случае это waypoint.js
        })
    });

//but it doesn't work(
PS I'm still learning, help me figure it out please.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question