2012-08-17 2 views
0

미리 감사드립니다.JQuery 스티커/다음 사이드 바를 사용하지만 상자 머리글 이미지가 텍스트와 함께 이동하지 않습니까?

나는 HERE의 스티커 사이드 바 코드를 사용하고 있으며 이미지 헤더를 상자에 추가하여 스타일을 사용자 정의했지만, 그 자리에있을 때 직접 볼 수있는 텍스트는 다음과 같습니다. thomas-dixon.com/joomla. 내가 사용

을 Heres 코드 : 어떤 도움

[view-source:http://thomas-dixon.com/joomla/][3] 

감사합니다.

답변

1

DEMO : http://jsfiddle.net/enve/hjeBP/

이 당신의 jQuery를 코드를 바꿉니다 :

<script type="text/javascript"> 
$(function(){ // document ready 

    if (!!$('#sidebar-left-content').length) { // make sure "#sidebar-left-content" element exists 

    var el = $('#sidebar-left-wrap'); 
    var stickyTop = $('#sidebar-left-content').offset().top; // returns number 
    var footerTop = $('#footer').offset().top; // returns number 
    var stickyHeight = $('#sidebar-left-content').height(); 
    var limit = footerTop - stickyHeight - 20; 

    $(window).scroll(function(){ // scroll event 

        var windowTop = $(window).scrollTop(); // returns number 

        if (stickyTop < windowTop){ 
        el.css({ position: 'fixed', top: 0 }); 
        } 
        else { 
        el.css('position','static'); 
        } 

        if (limit < windowTop) { 
        var diff = limit - windowTop; 
        el.css({top: diff}); 
        } 

        }); 

    } 
    });</script> 

작업 데모 : http://jsfiddle.net/enve/hjeBP/