jjzjj

fix-input-height

全部标签

javascript - jQuery(window).height() 不适用于移动浏览器

我有一个使用jQuery(window).height()的整页幻灯片,它在大多数浏览器上都能正常工作,但是我在我的手机(Android浏览器和Dolphin)上检查了它,幻灯片不断地增长,远远超过视口(viewport)的高度。这是我的代码:varheight=jQuery(window).height();jQuery('.slide').each(function(index,element){if(height>600)jQuery(this).height(height);elsejQuery(this).height(600);});jQuery(window).on('r

javascript - 数据 :image/jpeg;base64 how to get its width and height in pixels

如何获取其src在data:image/jpeg;base64中的像素图像的宽度和高度?使用设置img.src并调用width()没有成功。varimg=jQuery("");img.width()//=0 最佳答案 这会起作用:varimg=newImage();img.onload=function(){alert(this.width);}img.src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAA.......";FIDDLE我通过转换图像来确保base64有效here,onloa

javascript - 如何将 iron-input 双向绑定(bind)到 dom-repeat 的项目?

我刚开始玩Polymer1.0,正在尝试对集合进行非常简单的绑定(bind)。我能够在dom-repeat中显示文本,但是two-way绑定(bind)到iron-input不起作用。我尝试了字符串数组和对象。运气不好。{{item.value}}Polymer({is:"hello-world",ready:function(){this.data=[{value:"Hello"},{value:"World!"}];}}); 最佳答案 更改为:value="{{item.value::input}}"看这里:http://pln

javascript - 使用 box-sizing :border-box 时,jQuery.height() 在 WebKit 和 Firefox 中的行为不同

我有一个应用了以下样式的文本区域:textarea{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;}如果我随后运行以下javascript/jquery代码,使用Safari(5.0.6)和Chrome(16.0.x)时,我的文本区域的高度将减半:$('textarea').each(function(){var$this=$(this);$this.height($this.height());}根据.height()的jQuery文档,这是预期的行为,因为.height()返回内容高度(无填充、边框),而不管box

javascript - Phaser JS 如何停止从 textButton.events.onInputDown 事件到 game.input.onDown 事件的事件传播(触发)?

这是JSFiddle.我这里有两个事件。game.input.onDown执行一些逻辑(在我的示例中生成粒子)是textButton.events.onInputDown,其中textButton是一个Phaser.Text对象实例,执行另一个逻辑。问题是:当我点击我的textButton时,这两个事件都被触发了1和2。问题是,当我点击textButton时,如何防止事件1触发?部分代码:...//Thiseventisfiredonclickanywhereevent#1game.input.onDown.add(particleBurst,this);//ThisisClickab

javascript - 语法错误 : Unexpected end of input error using Gulp and main-bower-files package

在尝试将主要的Bower文件注入(inject)我的构建文件夹index.html时,我总是遇到错误我正在使用main-bower-filesNPMpackage.我的代码是这样的://requiresvargulp=require('gulp');varinject=require('gulp-inject');varconfig=require('./gulp-config');varmainBowerFiles=require('main-bower-files');gulp.task('default',['move'],function(){returngulp.src(co

javascript - 来自 jsdoc 的错误消息 "There are no input files to process"

Jsdoc在本地安装(npminstalljsdoc)。尝试执行时出现以下错误.\node_modules.bin\jsdoc--debug./lib/JavaScriptSource.js输出:调试:JSDoc3.3.0-dev(2014年6月15日星期日18:39:52GMT)调试:环境信息:{"env":{"conf":{"tags":{"allowUnknownTags":true},"templates":{"monospaceLinks":false,"cleverLinks":false,"默认":{"outputSourceFiles":true}},"source":

javascript - 在 Safari 5.1.2 中传递 Element.ALLOW_KEYBOARD_INPUT 时 webkitRequestFullScreen 失败

尝试使用javascript全屏api时,在Safari5.1.2中遇到以下问题。通过将以下行复制并粘贴到浏览器的已加载页面上,您可以看到效果。这适用于Chrome15和Safari5.1.2:javascript:document.querySelector('body').webkitRequestFullScreen();这在Chrome15中有效,但在Safari5.1.2中静默失败:javascript:document.querySelector('body').webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);AL

javascript - Angular 2 Material Input动态更改占位符

我想动态更改输入占位符的文本。console.log已经给出了更新后的字符串,但界面没有更新,所以旧的占位符仍然存在。如何让界面识别更改?document.getElementById(this.implicKey).setAttribute('placeholder',options[i].implication);console.log(document.getElementById(this.implicKey).getAttribute('placeholder')); 最佳答案 您可以像这样动态更改您的输入占位符Thisf

JavaScript/jQuery : how do I get the inner window height?

比如...不包括地址栏、书签等的高度,只是查看空间。$(window).innerHeight()似乎不起作用。 最佳答案 使用.height()为此,如API中所述:Thismethodisalsoabletofindtheheightofthewindowanddocument.$(window).height();//returnsheightofbrowserviewport$(document).height();//returnsheightofHTMLdocument至于为什么.innerHeight()不工作:Thi