guillermorangel
11/18/2014 - 7:38 PM

ScrollTo and LocalScroll

ScrollTo and LocalScroll

<?php


function scrollto_pin() {
    ?>

    <script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/js/jquery.scrollTo.js"></script>

    <script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/js/jquery.localScroll.js"></script>
        
    <!-- javascript that will initiate jQuery and the LocalScroll and pin the menu --> 
    <script type="text/javascript">
        // When the document is loaded...
        jQuery(document).ready(function()
        {
            // Scroll the whole document
            jQuery('#staff-navigation').localScroll({
               target:'body'
            });

            var aboveHeight = jQuery('#header').outerHeight(); 

            jQuery(window).scroll(function(){
 
                if (jQuery(window).scrollTop() < 133){
 
                    jQuery('#staff-menu-container').removeClass('fixed');
 
                } if (jQuery(window).scrollTop() > 133){
 
                    jQuery('#staff-menu-container').addClass('fixed');
                
                }
            });
        });
     
    </script>

    <?php
    } add_action('woo_head','scrollto_pin');

?>

?>