gpt4 book ai didi

jquery - 如何在没有 AngularJS 代码的情况下使用 jQuery 获得这种 Gmail 样式的滑动删除效果

转载 作者:行者123 更新时间:2023-11-28 08:30:56 25 4
gpt4 key购买 nike

这正是我正在寻找的,但我正在尝试仅使用 jQuery 来完成它: http://codepen.io/winkerVSbecks/pen/zfbiE

  <head>
<title>Swipe-Li - a swipeable checklist</title>

<script type="text/ng-template" id="accept-content.html">
<div class="icon-ok"></div>
</script>

<script type="text/ng-template" id="reject-content.html">
<div class="icon-cancel"></div>
</script>

<script type="text/ng-template" id="sample-content.html">
<div class="main-content">{{item.name}}</div>
</script>

<div class="container" ng-controller="MainCtrl">

<h1>
Swipe-Li <small>a swipeable checklist</small>
<a href="https://github.com/winkerVSbecks/swipe-li">github</a>
</h1>

<div ng-repeat="item in list">
<div
swipe-li
class="item"
disabled=""
intent="true"
accept="done(item)"
reject="skip(item)"
main-content="'sample-content.html'"
accept-content="'accept-content.html'"
reject-content="'reject-content.html'"
reset-to-content="false"
ng-class="{invert: item.doInvert}"
></div>
</div>
</div>

<!-- Dependencies -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.2/modernizr.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/hammer.js/1.1.3/hammer.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-touch.min.js"></script>
<!-- endDependencies -->

<!-- Scripts -->
<script src="swipe-li/swipe-li.min.js"></script>
<script src="js/app.js"></script>
<!-- endscripts -->

<!-- GA -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-22315045-8', 'auto');
ga('send', 'pageview');
</script>
<!-- END GA -->

'use strict';

angular.module('swipeLiDemo', [ '刷李']) .controller('MainCtrl', ['$scope', function ($scope) {

$scope.list = [
{
name: 'Spectacles',
doInvert: false
},
{
name: 'Giraffe',
doInvert: false
},
{
name: 'Turtle',
doInvert: false
},
{
name: 'Shark',
doInvert: false
},
{
name: 'Lamp',
doInvert: false
},
{
name: 'Chocolate',
doInvert: false
},
{
name: 'Beef',
doInvert: false
},
{
name: 'Drawer',
doInvert: false
},
{
name: 'Brocolli',
doInvert: false
},
{
name: 'Tomato',
doInvert: false
},
{
name: 'Plate',
doInvert: false
},
{
name: 'Zebra',
doInvert: false
}];

$scope.doInvert = false;

$scope.done = function (item) {
console.log('%s marked as accepted!', item);
item.doInvert = true;
};

$scope.skip = function (item) {
console.log('%s marked as rejected!', item);
item.doInvert = true;
};

}]);

最佳答案

我想第一个选择是找到一个执行它的 jQuery 插件。您可能会在这里找到它:

另一种选择是从 swipe-li 指令中提取逻辑,这里是 source code 的链接,但您可能需要了解一些 Angular ,以及 $scope 的工作原理。

swip-li 元素拥有 MIT 许可证。

关于jquery - 如何在没有 AngularJS 代码的情况下使用 jQuery 获得这种 Gmail 样式的滑动删除效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28271167/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com