foundation-sites: [Sticky] Bug does not play nicely with ajax content

I think I tried almost all foundation plugins and got them all working with ajax content, except for sticky. You can see it on this page: http://p352632.mittwaldserver.info/

You can see sticky is working. But when you first visit this site and go via the menu to the sticky plugin, the plugin does not get initialized. http://p352632.mittwaldserver.info/page2.html

This is how I initialze the plugins:


// Init on document ready
$(document).ready(function(){
    pageInit(document);
});

// Init with Ajax
$(function(){
    'use strict';
    var $page = $('#page'),
        options = {
            debug: false,
            prefetch: true,
            blacklist: '.no-smoothState',
            cacheLength: 7,
            onStart: {
                duration: 200, // Duration of our animation
                render: function ($container) {
                    // Add your CSS animation reversing class
                    $container.addClass('is-exiting is-inprogress');
                    // Restart your animation
                    smoothState.restartCSSAnimations();
                }
            },
            onProgress: {
                duration: 0,
                render: function ($container) {
                }
            },
            onReady: {
                duration: 0,
                render: function ($container, $newContent) {
                    // Remove your CSS animation reversing class
                    $container.removeClass('is-exiting');
                    // Inject the new content
                    $container.html($newContent);
                }
            },
            onAfter: function($container, $newContent) {
                pageInit($newContent);
            }
        },
        smoothState = $page.smoothState(options).data('smoothState');
});


function pageInit(scope) {
    // Init Foundation Plugins
    $(scope).foundation();
}


About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 3
  • Comments: 21 (16 by maintainers)

Most upvoted comments

Ok, sounds good. We’re thinking a lot of sticky fixes will happen in 6.2.5, so going to put this in that milestone and handle the .one issue for it.