草庐IT

CSS属性

全部标签

javascript - JavaScript 中的属性初始化

很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visitthehelpcenter.关闭10年前。我在JavaScript中创建了一个这样的类:varTest=function(){this.element=null;this.init=function(){if(Test.html==""){Test.loadHtml(this);return;}this.initElements();this.someMethodInternalCall();};this.initElements=fu

javascript - 为什么 JSON.stringify 不序列化不可枚举的属性?

我正在使用JavaScript将对象序列化为JSON字符串,我注意到只有可枚举的对象属性被序列化:vara=Object.create(null,{x:{writable:true,configurable:true,value:"hello",enumerable:false},y:{writable:true,configurable:true,value:"hello",enumerable:true}});document.write(JSON.stringify(a));//resultis{"y":"hello"}[pen]请问这是为什么?我搜索了MDNpage,json2

javascript - 基于 Promise 的属性 Ember

我有一个具有searchQuery和suggestions属性的Controller。这些建议来自AJAX请求。如何在我的Controller中使建议属性成为一个promise?app/controllers/application.jsimportEmberfrom'ember';const{computed,$}=Ember;exportdefaultEmber.Controller.extend({searchQuery:'',suggestions:computed('searchQuery',function(){return$.getJSON(`songs/search.j

javascript - 忽略 ASP.net 中的 Javascript、CSS 和图像文件路由

我上下调整了StackOverflow,但不幸的是,没有一个答案对我有帮助。我有一个Web应用程序,它使用VisualStudio提供的IIS在我的本地PC上完美运行,但是当我将此应用程序部署到服务器时,只有CSS才能正确显示。文件的文件夹结构如下:Root(此文件夹在服务器上名为KnowledgeManagement)CSSJS媒体上传文件图片用户我的代码,至少母版页的头部部分是这样的:然而,浏览器生成它是这样的:问题是除了CSS之外,JS文件夹中的文件和Media或Uploads文件夹和子文件夹中的文件都没有正确生成。问题是,如果我在图像src属性前添加“斜杠”,图像将获取位置ht

javascript - CSS @media 查询(和其他嵌套选择器)的正则表达式解析

我正在开发一个Node脚本,它使用正则表达式来解析CSS文件,并且它工作得很好......除了处理@media查询时。问题是由于嵌套的花括号让我很不舒服。我基本上想创建一个媒体查询中所有内容的捕获组:这是我到目前为止所获得的内容。@media[^{]+\{([^}]+)}\s*}这适用于一些简单的事情,例如:@media(max-width:868px){aside.size-toggle{display:none;}}但是不能拾取多个嵌套规则,像这样:@media(max-width:767px){#wrapper.sidebar-displayaside{left:0;transi

javascript - 使用预期条件时未定义属性 'bind'

我正在尝试使用预期条件函数让Protractor在继续之前等待页面上存在项目。http://angular.github.io/protractor/#/api?view=ExpectedConditions我已经按照文档中的示例进行操作,但是我收到有关未定义属性的错误。这似乎是使用任何预期条件时的情况,而不仅仅是与我在这里使用的presenceOf函数有关:varEC=protractor.ExpectedConditionsvarpixels=element.all(by.repeater('iteminitems'))varpixelsLoaded=EC.presenceOf(p

javascript - 当我在 css 中使用 margin auto 属性时,如何使用 javascript 获取 margin left size

我有div与margin:auto;我只需要得到margin-left使用javascript的大小值:)//css.test{margin:auto;width:100px;height:100px;outline:1pxsolidred;}//htmlTestLiveexample 最佳答案 使用这个:1)使用jQueryvarleft=$(".test").offset().left;2)或者,第二个版本是:将您的div替换为,并使用这个js。varleft=document.getElementById("test").of

javascript - vueJS + webpack : importing fonts, CSS 和 node_modules

我开始使用Vue.js和Webpack,我对如何正确导入和引用我的字体、CSS和node_modules有一些疑问。我使用vue-cli启动了我的应用程序,结果结构如下:buildconfignode_modulessrc--assets--components--routerstatic这是我的webpack.base.conf文件:varpath=require('path')varutils=require('./utils')varconfig=require('../config')varvueLoaderConfig=require('./vue-loader.conf')

javascript - 如何使用 Jest 和 Enzyme 在 React 中测试表单提交?无法读取未定义的属性 'preventDefault'

我正在编写一个测试来检查如果提交的登录表单没有数据,是否会显示错误通知组件。describe('Usersignin',()=>{it('shouldfailifnocredentialsareprovided',()=>{constloginComponent=shallow();expect(loginComponent.find('.form-login').length).toBe(1);loginComponent.find('.form-login').simulate('submit');expect(loginComponent.find(Notification).l

javascript - 如何将 Javascript 变量值放入 CSS?

如何让time变量的内容显示为content我的CSS中的属性?JavaScript:functionclock(){vard=newDate();varhour=d.getHours();varmin=d.getMinutes();vartime=hour+":"+min;}CSS:.screen{position:absolute;height:75%;width:75%;background:#98E8EE;top:11.5%;left:12.5%;}.screen::after{color:#F9F5F4;font-size:40px;content:;font-family: