Ionic 1 - 无法在IE上选择文字 [英] Ionic 1 - Can't select text on IE

查看:156
本文介绍了Ionic 1 - 无法在IE上选择文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过添加:

.scroll {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
}

我可以在桌面浏览器上选择文字 >。

I can select text on desktop browsers except on IE.

我发现当我评论我的导入时:

I figure out that when I comment my import :

//require('ionic-npm/js/ionic');

在IE上我可以选择文本,但我需要离子,所以我不能评论这一行。

On IE I can select text but I need ionic so I can't comment that line. Also I don't what to touch to ionic.js.

你有什么想法吗?

推荐答案

我在这里找到了答案:


forum.ionicframework:如何让文本可选? >

forum.ionicframework: How to make text selectable?

链接:

Link: Original forum Post

您是指在移动设备还是桌面设备上使用此技术?

Are you referring to using this technique on mobile or desktop?

在移动设备上,它似乎仍然为我工作,但如果它不是为您在桌面上工作,这可能是因为它不工作,如果用户可以使用他们的鼠标点击和-drag滚动页面。要禁用此类滚动,您可以对内容启用溢出滚动:

On mobile it still seems to be working for me, but If it isn't working for you on desktop, that might be because it doesn't work if the user can use their mouse to click-and-drag to scroll the page. To disable this type of scrolling you can either enable overflow-scroll on your content:

<ion-content overflow-scroll="true">

或者您可以通过进一步更改ionic来禁用鼠标单击和拖动滚动事件。 js like so ...

Or you can disable the mouse click-and-drag-to-scroll events by further changing ionic.js like so...

将'return;'添加到此mouseDown函数的开头:

Add 'return;' to the beginning of this mouseDown function:

self.mouseDown = function(e) {
if ( ionic.tap.ignoreScrollStart(e) || e.target.tagName === 'SELECT' ) {
  return;
}
self.doTouchStart(getEventTouches(e), e.timeStamp);

if( !ionic.tap.isTextInput(e.target) ) {
  e.preventDefault();
}
mousedown = true;
};

这样看起来像这样:

self.mouseDown = function(e) {

return; // <--- This disables all mouseDown events from scrolling the page

if ( ionic.tap.ignoreScrollStart(e) || e.target.tagName === 'SELECT' ) {
  return;
}
self.doTouchStart(getEventTouches(e), e.timeStamp);

if( !ionic.tap.isTextInput(e.target) ) {
  e.preventDefault();
}
mousedown = true;
};

此更改使您仍然可以使用鼠标滚轮的离子滚动功能,单击并拖动滚动,以便您可以使用鼠标选择文本。

This change makes it so you can still use the ionic scroll features with your mouse wheel, but disables mouse click-and-drag scrolling so that you can use your mouse to select text.

这篇关于Ionic 1 - 无法在IE上选择文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆