• I have this code (posted bottom) which I have put inside my template file for my home page. It locks my primary sidebar in place after the window scrolls down a certain amount. Problem is I want this to work with all my templates, now i can just paste this code into all my template files but I know there is a better way I just don’t know how. Should it go in the functions file some how?

    <script>
    
      window.onload = function( ){
    		jQuery( window ).scroll( function( ){ 
    
    			var scroller_object = jQuery( "#sidebar-primary" );
    			var num=305;
    
    			if( document.documentElement.scrollTop >= num || window.pageYOffset >= num )
    			{
    				if( jQuery.browser.msie && $.browser.version == "6.0" )
    				{
    					scroller_object.css( "top", ( document.documentElement.scrollTop + 15 ) + "px" );
    				}
    				else
    				{
    					scroller_object.css( { position: "fixed", top: "285px" } );
    				}
    			}
    			else if( document.documentElement.scrollTop < num || window.pageYOffset < num )
    			{
    				scroller_object.css( { position: "absolute", top: "590px" } );
    			}
    		} );
    	}
      </script>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Sliding div after certain window scroll’ is closed to new replies.