我有带jquery终端的网页和隐藏的textarea(触发Android虚拟键盘),我可以输入字符但是当我输入几个命令时,内容隐藏在虚拟键盘后面.终端内容滚动到底部,因为当我输入更多命令时它会滚动.当我在手机中使用硬件键盘时,滚动是正确的(触摸滚动还没有工作).
我添加了这个CSS
.terminal textarea { top: 0; width:0; margin-left: -8px; pointer-events: none; }
Run Code Online (Sandbox Code Playgroud)
对于prevoius
.terminal .clipboard {
position: absolute;
bottom: 0;
left: 0;
opacity: 0.01;
filter: alpha(opacity = 0.01);
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0.01);
width: 2px;
}
.cmd > .clipboard {
position: fixed;
}
Run Code Online (Sandbox Code Playgroud)
并在插件中使用此代码(textarea用于剪贴板).
self.click(function() {
self.find('textarea').focus();
});
Run Code Online (Sandbox Code Playgroud)
我的问题是:javascript可以检测出虚拟键盘的大小吗?或者也许还有其他方法来改变网页的大小,所以它只是在视觉部分(不是键盘的位置)?或者我的代码可能有问题,它不适用于移动设备.即使用户安装了不同的键盘,键盘的大小也始终相同吗?
当我使用Emacs时,它会创建临时文件,例如#foo.txt#我如何添加模式以.gitignore忽略这些文件(#由git解释为.gitignore中的注释)
我在history.state和popstate中有数组的状态和索引数组我读了数组的内容,它工作正常但是当我回到第一页并刷新数组时(不正常)但是前进历史国家仍然.
是否可以删除使用pushState创建的虚假历史记录?
我无法将我的状态存储在localStorage中,因为我的状态数组中有函数.
我想要做的是,在插入DOM之前手动处理transclude并修改内容:
return {
restrict: 'E',
transclude: true,
template: '<HTML>',
replace: true,
link: function(scope, element, attrs, ngModelCtrl, $transclude) {
var caption = element.find('.caption');
$transclude(function(clone) {
console.log(clone);
clone.filter('li').addClass('ng-hide'); // this don't work
clone.addClass('ng-hide'); // same this one
clone.attr('ng-hide', 'true'); // same this one
$compile(clone)(scope.$new()).appendTo(caption);
caption.find('li').addClass('ng-hide'); // and this
});
}
}
Run Code Online (Sandbox Code Playgroud)
在angular.js源代码中我找到了这个例子:
var templateElement = angular.element('<p>{{total}}</p>'),
scope = ....;
var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) {
//attach the clone to DOM document at the right place
});
//now we have reference to …Run Code Online (Sandbox Code Playgroud) 我刚从github克隆angular2-seed项目并按照步骤进行操作,但是我在VS代码中得到了这个警告[ts]对装饰器的实验支持是一个在将来的版本中可能会发生变化的功能.设置'Exxperimentaldecorators'选项以删除此警告.
我有这样的代码:
span {
border-radius: 50%;
background-color: #d8d9dd;
border: 6px solid #262c40;
width: 25px;
height: 25px;
margin: 30px 0 0 40px;
display: block;
}
span:before {
content: attr(data-value);
position: relative;
white-space: pre;
display: inline;
top: -27px;
left: -29px;
width: 200px;
text-align: center;
}Run Code Online (Sandbox Code Playgroud)
<span data-value="November 2016"></span>
<span data-value="May 2016"></span>Run Code Online (Sandbox Code Playgroud)
如何将文本居中:在伪元素位于跨度的中间?可能吗?
我需要知道是否有办法从子模块访问父模块.如果我导入子模块:
from subprocess import types
Run Code Online (Sandbox Code Playgroud)
我有types- 有一些Python魔术可以访问subprocess模块types吗?对于类来说类似的东西().__class__.__bases__[0].__subclasses__().
我有使用以下内容创建的消息列表:
var messages = ["Foo Bar", "Lorem Ipsum", "Dolor Sit Amet"];
app.controller('fooControler', function($scope) {
$scope.messages = [
{"message": "Hello There"}
];
function insert() {
var random = Math.round(Math.random()*(messages.length-1));
var message = messages[random];
messages.splice(random, 1);
$scope.$apply(function() {
$scope.messages.push({message: message});
});
if (messages.length) {
setTimeout(insert, 5000);
}
}
setTimeout(insert, 5000);
});
Run Code Online (Sandbox Code Playgroud)
我的ng-html看起来像这样:
<html ng-app="app">
<body ng-controller="fooControler">
<header>
<div>You have {{messages.length}} messages</div>
<ul ng-repeat="message in messages">
<li>{{message.message}}</li>
</ul>
</header>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我如何FadeOut消息并删除它们?我知道如何在jQuery中这样做,但我怎么能用AngularJS方式呢?
我试过这个:
import $ from 'jquery';
window.jQuery = $;
import angular from 'angular';
Run Code Online (Sandbox Code Playgroud)
但$ .fn.scope未定义,ng-bind-html中的脚本不起作用使用ngBindHtml注入脚本标记
也在webpack配置中试过这个
module.exports = {
module: {
loaders: [
{ test: /angular(\.min)?\.js$/, loader: "imports?$=jquery" },
{ test: /jquery(\.min)?\.js$/, loader: 'expose?jQuery' }
]
}
};
Run Code Online (Sandbox Code Playgroud)
但得到了错误:
ERROR in ./~/angular/angular.js
Module not found: Error: Cannot resolve module 'expose' in C:\project\src\ui\node_modules\angular
@ ./~/angular/angular.js 2:8-25
Run Code Online (Sandbox Code Playgroud)