美文网首页
ionic1 文字长按复制、粘贴问题解决

ionic1 文字长按复制、粘贴问题解决

作者: my木子 | 来源:发表于2019-12-06 15:46 被阅读0次
// html
<html ng-app="ionicApp">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title>Ionic文字复制问题</title>
    <link href="http://code.ionicframework.com/1.0.0-beta.4/css/ionic.css" rel="stylesheet">
    <script src="http://code.ionicframework.com/1.0.0-beta.4/js/ionic.bundle.js"></script>
</head>
<body ng-controller="MyCtrl">
    <ion-header-bar class="bar-positive">
        <h1 class="title">ionic 测试copy</h1>
    </ion-header-bar>
<!-- 
    1、注意 overflow-scroll="true"   
    2、selectable不能加在ionic的特定标签
 -->
    <ion-content overflow-scroll='true'>
        <div class="selectable">幻灯片1测试文字,试试可以复制</div>
    </ion-content>
</body>
</html>

// css
ion-content{
  overflow-scroll: true;
}
.scroll-content {
  -webkit-user-select: auto !important;
  -moz-user-select: auto !important;
  -ms-user-select: auto !important;
  user-select: auto !important;
}

.selectable {
  -webkit-user-select: auto;//控制网页内容选择范围
}

// js
angular.module('ionicApp', ['ionic'])
.controller('MyCtrl', function($scope) {
  stop_browser_behavior: false  
self.touchStart = function(e) {
  self.startCoordinates = getPointerCoordinates(e);
  if ( ionic.tap.ignoreScrollStart(e) ) {
    return;
  }
  if( ionic.tap.containsOrIsTextInput(e.target) ) {
    // do not start if the target is a text input
    // if there is a touchmove on this input, then we can start the scroll
    self.__hasStarted = false;
    return;
  }
  self.__isSelectable = true;
  self.__enableScrollY = true;
  self.__hasStarted = true;
  self.doTouchStart(e.touches, e.timeStamp);
  // e.preventDefault();
};
});

javascript的self和this使用小结

http://www.cnblogs.com/reommmm/archive/2010/01/20/1652469.html

相关文章

网友评论

      本文标题:ionic1 文字长按复制、粘贴问题解决

      本文链接:https://www.haomeiwen.com/subject/ielegctx.html