2013-10-14 18 views
0

我一直在嘗試使用航點的粘性extenstion,通過角JS jQuery的直通工作。 jQuery UI的直通作品一般,但我不能得到粘的工作。這是迄今爲止我嘗試過的一個很好的例子。航點粘不與角JS jQuery的直通

http://jsfiddle.net/lilacsunbird/bC5ts/

HTML:

<h2 class="my-sticky-element" ui-jq="waypoint" ui-options="sticky">Sticky 

控制器:

angular.module('waypoints', ['ui']); 

/* Controllers */ 
function WaypointsController($scope) { 


    $scope.sticky = 'sticky'; 


    $scope.test = function(){ 
     alert('You have scrolled to an entry.'); 
    } 
} 

非常感謝

回答

3

按照文檔here,粘插件只提供掛鉤使事情變得粘但實際上沒有風格下襬如此。這是留給你來決定如何「粘」的樣子。

的小提琴被設置和取消的.stuck類,其指示當元件被卡住,因爲它應該。你只需要應用它的樣式。一個很簡單的例子是:

.stuck { 
    top: 0px; 
    position: fixed; 
} 

更新的小提琴是在這裏:http://jsfiddle.net/4Mt4K/1/