cancel-ng-swipe-right-on-child
<!DOCTYPE html>
<html lang="en" ng-app="myapp">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<!-- add styles -->
<link href="css/style.css" rel="stylesheet" type="text/css" />
<!-- add javascripts -->
<!-- <script src="js/jquery-2.1.3.min.js"></script> 不需要 -->
<script src="js/angular.min.js"></script>
<!-- <script src="js/angular-animate.min.js"></script> 不需要 -->
<script src="js/angular-touch.min.js"></script>
<script src="js/app.js"></script>
<title>一个页面存在多个swipe时,互不影响cancel-ng-swipe-right-on-child</title>
</head>
<body ng-controller="MyCtrl">
<div id="page" ng-cloak ng-swipe-left="showMenu = true">
<h1>Angular Swipe Menu</h1> <div class="menu-grip box" ng-show="!showMenu" ng-click="showMenu = true">
.<br />.<br />.
</div>
<nav class="menu box" ng-show="showMenu" ng-swipe-right="showMenu = false">
<ul>
<li class="menu_item" ng-repeat='nav in navigation'>
<a class="menu_link" ng-href="{{nav.href}}" ng-bind="nav.title"></a>
</li>
</ul>
</nav>
<div class="big-swiper box" ng-swipe-right="next();stopActions($event);" ng-swipe-left="prev();stopActions($event);" ng-bind="index"></div>
</div>
</body>
</html>
<!-- http://jsfiddle.net/scottux/RLDsU/ -->
*{margin:; padding:; border: none;}
html, body, #page{height: 100%; min-height: 100%;}
.box{background-color: #EFEFEF; box-shadow: 0 1px 2px #dedede; border: 1px solid #ddd; border-radius: 4px;}
.menu{float: right; min-height:100%; width: 98%;}
.menu_item{line-height:;}
.menu_link{display:block; padding-left:1em;}
.menu_link:hover{background: #DEDEDE;}
.menu-grip{float:right; height:5em; line-height:.5; padding-top:2em; text-align:center; width:1em;}
h1{background:black; color:white; font-size:1.1em; line-height:1.3;}
.big-swiper{font-size: 5em; height:3em; line-height:; margin:.5em auto; text-align:center; width:4em;}
.big-swiper:before{content:'<\a0'; color:#dedede; font-weight:;}
.big-swiper:after{content:'\a0>'; color:#dedede; font-weight:;}
var app = angular.module('myapp', ['ngTouch']); app.controller('MyCtrl', function MyCtrl($scope) {
$scope.stopActions = function (event) {
if (event.stopPropagation) {
event.stopPropagation();
}
// if (event.preventDefault) {
// event.preventDefault();
// }
// event.cancelBubble = true;
// event.returnValue = false;
}; // Carousel thing
$scope.index = 0;
// Hide menu
$scope.showMenu = false;
// Links
$scope.navigation = [{
title: "Page A",
href: "#pageA"
}, {
title: "Page B",
href: "#pageB"
}, {
title: "Page C",
href: "#pageC"
}];
// Increment carousel thing
$scope.next = function () {
//stopActions($event);
$scope.index++;
};
// Decrement carousel thing
$scope.prev = function () {
//stopActions($event);
$scope.index--;
};
});
转载请备注。
cancel-ng-swipe-right-on-child的更多相关文章
- Volley HTTP库系列教程(2)Volley.newRequestQueue示例,发请求的流程,取消请求
Sending a Simple Request Previous Next This lesson teaches you to Add the INTERNET Permission Use n ...
- Go语言Context(设计及分析)
context简单概述: Go服务器的每个请求都有自己的goroutine,而有的请求为了提高性能,会经常启动额外的goroutine处理请求,当该请求被取消或超时,该请求上的所有goroutines ...
- golang中的context包
标准库的context包 从设计角度上来讲, golang的context包提供了一种父routine对子routine的管理功能. 我的这种理解虽然和网上各种文章中讲的不太一样, 但我认为基本上还是 ...
- Android开发训练之第五章第七节——Transmitting Network Data Using Volley
Transmitting Network Data Using Volley GET STARTED DEPENDENCIES AND PREREQUISITES Android 1.6 (API L ...
- Golang Context 详细介绍
Golang context 本文包含对context实现上的分析和使用方式,分析部分源码讲解比价多,可能会比较枯燥,读者可以直接跳过去阅读使用部分. ps: 作者本着开源分享的精神撰写本篇文章,如果 ...
- golang context 剖析 1.7.4 版本
1. 内部结构之 - timerCtx . type timerCtx struct { cancelCtx timer *time.Timer // Under cancelCtx.mu. dead ...
- Angular6 基础(数据绑定、生命周期、父子组件通讯、响应式编程)
Angular相比于vue来说,更像一个完整的框架,本身就集成了很多模块,如路由,HTTP,服务等,而vue是需要另外引入比如(vuex,axios等).Angular引入了依赖注入.单元测试.类等后 ...
- golang从context源码领悟接口的设计
注:写帖子时go的版本是1.12.7 go语言中实现一个interface不用像其他语言一样需要显示的声明实现接口.go语言只要实现了某interface的方法就可以做类型转换.go语言没有继承的概念 ...
- 深度解密Go语言之context
目录 什么是 context 为什么有 context context 底层实现原理 整体概览 接口 Context canceler 结构体 emptyCtx cancelCtx timerCtx ...
- 带小伙伴手写 golang context
前言 - context 源码 可以先了解官方 context.go 轮廓. 这里捎带保存一份当前 context 版本备份. // Copyright 2014 The Go Authors. Al ...
随机推荐
- Kendo UI for Angular 2 控件
Kendo UI for Angular 2 控件 伴随着 Angular 2 的正式 release,Kendo UI for Angular 2 的第一批控件已经发布了,当前是 Beta 版本,免 ...
- iOS中MVC等设计模式详解
iOS中MVC等设计模式详解 在iOS编程,利用设计模式可以大大提高你的开发效率,虽然在编写代码之初你需要花费较大时间把各种业务逻辑封装起来.(事实证明这是值得的!) 模型-视图-控制器(MVC)设计 ...
- eclipse 比较好的插件
tomcat 插件 egit github 插件 subeclipse 插件 Properties Editor Properties Editor 编辑java的属性文件,并可以自动存盘为Unico ...
- requirejs 合并方案
http://snandy.iteye.com/blog/1595464 http://www.cnblogs.com/snandy/archive/2012/03/05/2378105.html h ...
- SharePoint REST api
http://msdn.microsoft.com/en-us/magazine/dn198245.aspx Understanding and Using the SharePoint 2013 R ...
- codeforces C. Sereja and Swaps
http://codeforces.com/contest/426/problem/C 题意:找出连续序列的和的最大值,可以允许交换k次任意位置的两个数. 思路:枚举区间,依次把区间内的比较小的数换成 ...
- codeforces D. Long Path
http://codeforces.com/contest/408/problem/D 题意:有一排房间每个房间有两扇门,一扇通往第i+1个房间,另一扇通往第p[i]个房间,(p[i]<=i)然 ...
- Church encoding
In mathematics, Church encoding is a means of representing data and operators in the lambda calculus ...
- 数据结构典型算法的VC实现(袁辉勇)
1. 迷宫问题求解 #include <stdio.h> #define m 8 //迷宫内有8列 #define n 8 //迷宫内有8行 #define MAXSIZE 100//栈尺 ...
- python关键字、转义符和字符串格式化
最近在学learn python the hard way,学习到第37章,进行了关于关键字.转义符和字符串格式化的总结.看手头上的中文版没有及时更新.于是就把这些翻译过来,以作查阅. 关键字: 关键 ...