草庐IT

types_and_classes

全部标签

javascript - 对象属性值作为类名,ng-class

试图寻找这个问题的答案,但没有成功。在angularJS中使用ng-class时,是否可以将属性的值作为类名?我的意思的一个例子:varthings=[{a:"abc",aTrue:true}];然后在Angular中(在这个例子中使用ng-repeat)我正在寻找类名"abc"-但这给了我一个类名"thing.a"。这甚至可能吗,我哪里错了?在此先致谢,感谢您的帮助。 最佳答案 不起作用的原因是因为它的行为就像一个Javascript对象,所以你不能在javascript中执行此操作,对吗vartest='hello';varob

javascript - Force Masonry/similar to ignore flow and fill gaps 相反

Masonry/Isotope/Freetile和其他在网格/容器中绝对定位元素方面做得很好。但是,当元素占据网格/容器的整个宽度时,它会产生巨大的间隙,这是NotAcceptable结果。这是我的问题的一个jsfiddle:http://jsfiddle.net/QNf3A/1/红色div顶部有足够的空间放置绿色div。然而,不同的图书馆倾向于尊重流程,而不是“不留缝隙”的理念。有谁知道替代的js库或类似的技巧来避免差距?-来自jsfiddle的代码...HTML:CSS:#container{width:600px;background-color:#EEE;}.block{flo

javascript - Javascript 中的 Lang.Class

我正在尝试使用GJS(GnomeJavascript)开发GnomeShell扩展,但是,我遇到了Lang库(我认为它是一个库,如果我不正确的话)。但是我在网上找不到任何关于它的资源。在代码中它看起来像这样:constLang=imports.lang;constObjectA=newLang.Class({...});我在哪里可以找到有关它的文档?它是Gnome库吗?Mozilla库? 最佳答案 它是gjs的内置模块--参见modules/lang.js.它包括两个主要部分:bind()(使“this”指向闭包中的逻辑对象的助手)

javascript - 从子类调用父类(super class)方法 - JavaScript

这个问题在这里已经有了答案:关闭10年前。PossibleDuplicate:setattributewithjavascriptsupermethod为了好玩,我正在尝试用HTML5创建一个简单的游戏。我有一个Entity类,它应该是Player类的父类(superclass)。functionEntity(x,y){this.x=x;this.y=y;this.tick=function(){//Dogenericstuff}}functionPlayer(x,y){this.parent.constructor.call(this,x,y);this.tick=function(

JavaScript/jQuery : create and post virtual form

关闭。这个问题不符合StackOverflowguidelines.它目前不接受答案。关于您编写​​的代码问题的问题必须在问题本身中描述具体问题—并且包括有效代码以重现它。参见SSCCE.org寻求指导。关闭9年前。Improvethisquestion在javascript中,我有一些数据想作为帖子发送(不是ajax)。它的行为应该与用户单击提交按钮一样。但是,我没有实际的表格。数据从页面收集到各种变量中,包括我编码为json的数组。我可以创建一个带有display:none的html表单,将值放入此表单,然后触发不可见的提交按钮。有没有更好的办法?

javascript - 在 Typescript 中,从 Typeings 导入时如何使用 Javascript 模块

使用mgechev'sangular2-seed,我正试图掌握Angular2和一个新项目的typescript,但遇到了这个问题。我想在组件中使用数字,所以我:使用npminstallnumeral安装Numeral使用typingsinstalldt~numeraljs--global--save安装了数字类型在我的组件中添加了import{numeral}from'/typings/globals/numeraljs';添加了代码行:letnum:Number=newNumber(numeral().unformat(text));到目前为止,还不错。一切似乎都可以正常进行。直到

javascript - WordPress Revolution slider : Unmuting failed and the element was paused instead because the user didn't interact with the document before

当我遇到以下JavaScript错误(在GoogleChrome中)时,我试图在ThemePunchSliderRevolution5.4.2中自动播放视频:Unmutingfailedandtheelementwaspausedinsteadbecausetheuserdidn'tinteractwiththedocumentbefore.revolution.extension.video.min.js:7 最佳答案 OP的回答:在网上苦苦思索了3天后,我决定打开出现错误的脚本,即:revolution.extension.vi

javascript - 中级 JavaScript : assign a function with its parameter to a variable and execute later

我有一个JavaScript函数:functionalertMe($a){alert($a);}我可以这样执行:alertMe("Hello");我想做的是将带有"Hello"参数的alertMe("Hello")赋给一个变量$func,然后稍后可以通过执行$func();之类的操作来执行此操作。 最佳答案 我想添加评论作为答案代码//definethefunctionfunctionalertMe(a){//returnthewrappedfunctionreturnfunction(){alert(a);}}//declaret

javascript - jQuery : a drag-and-drop upload with multi dropzone

我想开发一个文件夹和文件树,通过文件夹拖放上传。例子:对于拖放上传,我资助jQueryFileUpload.基本代码是:$('#fileupload').fileupload({dataType:'json',url:'php/index.php',dropZone:$(document),done:function(e,data){$.each(data.result,function(index,file){$('').text(file.name).appendTo(document.body);});}});在我的项目中,我有多个放置区(我的文件夹),例如:BookmarksS

javascript - AngularJS 指令 : compile template and watch scope

我在Angularjs上编写了一个非常复杂的应用程序。这已经大到让我感到困惑了。我对Angular进行了更深入的研究,发现我的代码很糟糕。我理解这个概念:module.directive('createControl',function($compile,$timeout){scope:{//scopebindingswith'='&'@'},template:'Templatestringwithbinded{{variables}}',link:function(scope,element,attrs){//Functionwithlogic.Shouldwatchscope.}我