javascript - Foundation 5 清除灯箱不适用于 angularjs 动态图像

标签 javascript css angularjs zurb-foundation-5

我正在尝试将 Zurb Foundation 5 中的清除灯箱组件用于我的 angularjs 应用程序,但我还没有找到方法,示例代码在这里:

使用下面的代码我得到的是一团糟,但它应该看起来像 Foundation Clearing documentation

<html>
<head>
    <title>TODO supply a title</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <link href="http://cdn.foundation5.zurb.com/foundation.css" rel="stylesheet"/>
</head>
<body>       
    <div ng-app="app" ng-controller="ClearingController">
        <ul class="clearing-thumbs large-12 columns small-block-grid-4" data-clearing>
            <li ng-repeat="imagen in imagenes"><a href="{{imagen}}"><img ng-src="{{imagen}}"></a></li>
        </ul>
    </div>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="http://cdn.foundation5.zurb.com/foundation.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
    <script type="text/javascript">
                angular.module('app', [])
                        .controller('ClearingController', ['$scope', function($scope) {
                                $scope.imagenes = ["http://placehold.it/1000x1000&text=image1", "http://placehold.it/1000x1000&text=image2", "http://placehold.it/1000x1000&text=image3", "http://placehold.it/1000x1000&text=image4", "http://placehold.it/1000x1000&text=image5", "http://placehold.it/1000x1000&text=image6", "http://placehold.it/1000x1000&text=image7", "http://placehold.it/1000x1000&text=image8"];
                                $(document).foundation();
                            }]);

    </script>
</body>
</html>

有人知道如何让它发挥作用吗?

最佳答案

在测试时它抛出了 Uncaught ReferenceError: Modernizr is not defined 所以添加了http://www.modernizr.com/downloads/modernizr-latest.js , 由 foundation.js 内部使用

根据 documentation $(document).foundation();应该在 </body> 之前和 $(document).foundation();初始化 Foundation 脚本,以便移出 Angular 范围。

示例:http://codepen.io/anon/pen/eNwGQq

关于javascript - Foundation 5 清除灯箱不适用于 angularjs 动态图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31884370/

相关文章:

CSS 定位 : Full-width header shall have the same left margin as the centered content-div

angularjs - 元素不可见错误: Cannot click on element-error in Protractor IE browser

javascript - 删除动态添加到 ng-repeat(angularjs) 的值

javascript - 我无法从 query.find().then(function(results) 获取数据,它似乎只是本地的

javascript - 如何将 Jade 标记插入到浏览器中的 DOM 元素中

html - 用 2 个分隔线分割屏幕

angularjs - .NET Core 3 预览版 : Synchronous operations are disallowed

javascript - React router dom无法获取页面

javascript - 使用 jQuery 将 HTML 标记(包括 `onclick` 属性)动态附加到页面

javascript - 以编程方式停止 html/javascript/css 中的特定代码块