WordPress.org

Ready to get started?Download WordPress

Forums

Digg Digg
Ajax: Scrolling back up causes the post image to misalign down (2 posts)

  1. brijux
    Member
    Posted 3 years ago #

    See the issue here http://brijux.com/2010/05/05/current-library-system-is-very-inefficient/

    Plugin works great except when I scroll back up, posts with images are mis-aligned and they are shifted down. There is no issue on posts without images.

    I have made a video of this in case my site layout is changed. http://www.youtube.com/watch?v=MBURHwN3VbI

    Here is my code
    --- Initial Position ---

    .dd_ajax_float{
    	background:none repeat scroll 0 0 #FFFFFF;
    	border:1px solid #DDDDDD;
    	float:left;
    	margin-left:-95px;
    	margin-right:10px;
    	margin-top:0px;
    	position:absolute;
    	z-index:1;
    }

    --- Scrolling Position ---

    $j=jQuery.noConflict();
    
    $j(document).ready(function($) {
    
    	//put content div class, when scroll beyond this y, float it
    	var $postShare = $('.dd_ajax_float');
    
    	if($('.dd_content_wrap').length > 0){
    
    		var descripY = parseInt($('.dd_content_wrap').offset().top) - 20;
    		var pullX = $postShare.css('margin-left');
    
    		$(window).scroll(function () { 
    
    			var scrollY = $(window).scrollTop();
    			var fixedShare = $postShare.css('position') == 'fixed';
    
    			//make sure .post_share exists
    			if($('.dd_ajax_float').length > 0){
    
    				if ( scrollY > descripY && !fixedShare ) {
    					$postShare.stop().css({
    						position: 'fixed',
    						left: '50%',
    						top: 20,
    						marginLeft: -560
    
    					});
    				} else if ( scrollY < descripY && fixedShare ) {
    					$postShare.css({
    						position: 'relative',
    						left: 0,
    						top: 0,
    						marginLeft: pullX
    					});
    				}
    
    			}
    
    		});
    	}
    
    });

    http://wordpress.org/extend/plugins/digg-digg/

  2. mkyong
    Member
    Posted 3 years ago #

    try upgrade to latest v4.5

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags