2015-06-03 62 views
0

我有問題與Ajax內容https://github.com/desandro/sticky-titles 我沒有再由.load函數初始化它還是新的內容doent得到正確的數據屬性Ajax內容

stickies=jQuery(".followMeBar"); 
      console.log(stickies); 
    stickies.each(function(){ 
    console.log('in load each'); 
     var thisSticky = jQuery(this).wrap('<div class="followWrap" />'); 
      thisSticky.parent().height(thisSticky.outerHeight()); 

     jQuery.data(thisSticky[0], 'pos', thisSticky.offset().top); 

    }); 
+0

jQuery.data(thisSticky [0],'pos',thisSticky.offset()。top);那條線應該做什麼? –

回答

0

得到解決它通過創建固定頭的分隔div

/*Code for fixed date row*/ 
       var flipVal;// offset value of current date on top 
       var currentIndex=0;//index value of current date on top 
       var topOffsetValue=51;//(constant) offset value of fixed date from window top 
       var stickDateToTop = function(){ 
        var elements=jQuery(".order-date");//get obj of all date row elements 
          elements.each(function(index, value){ 
           var thisObj = jQuery(value); 
           var divOffset = thisObj.offset().top; 
           currentElemnt=jQuery(elements[currentIndex]); 
           /* to Handle to date on scroll up */ 
           if(currentElemnt.offset().top>flipVal){ 
            var backObj=jQuery(elements[currentIndex-1]); 
            jQuery('#topDate').html(backObj.html()); 
           } 
           /* to Handle to date on scroll down */ 
           if(divOffset <topOffsetValue && divOffset>0){ 
            currentIndex=index; 
            flipVal=divOffset; 
            jQuery('#topDate').html(thisObj.html()); 
           } 
          }); 
       } 
       /*End of Code for fixed date row*/ 
<div id="topDate" class="order-date-main fixed"> 
      <!--fixed date here --> 
     </div>