我正在尝试使用jQuery更改css,但使用jQuery不会保存const path = require ( 'path' )
module.exports =
{ entry: './src/boot.tsx'
, node:
{ __dirname: false
}
, output:
{ path: path.resolve ( __dirname, 'app', 'build' )
, filename: 'app.js'
, publicPath: '/live-reload/'
}
, devtool: 'source-map'
, resolve:
{ extensions: ['', '.js', '.ts', '.tsx']
}
, module:
{ loaders:
[ { test: /\.tsx?$/
, exclude: /node_modules/
, loader: 'ts-loader'
}
]
}
}
属性。
使用jQuery还有什么其他解决方案?
FabricTransportSettings transportSettings = new FabricTransportSettings
{
OperationTimeout = TimeSpan.FromSeconds(30)
};
var retrySettings = new OperationRetrySettings(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(1), 5);
var clientFactory = new Microsoft.ServiceFabric.Services.Remoting.FabricTransport.Client.FabricTransportServiceRemotingClientFactory(transportSettings);
var serviceProxyFactory = new Microsoft.ServiceFabric.Services.Remoting.Client.ServiceProxyFactory((c) => clientFactory, retrySettings);
var client = serviceProxyFactory.CreateServiceProxy<IXyzService>(new Uri("fabric:/Xyz/Service"));
return client;
答案 0 :(得分:1)
您可以手动设置整个样式属性
var style_text = '';
$.each(styleCSS, function(k,v) {style_text += k+':'+v+';';});
$('.container').find('.hide-me').attr('style', style_text);
styleCSS = {
'display': 'none',
'height' : '0px',
'line-height' : '0px',
'max-height' : '0px',
'overflow' : 'hidden',
'font-size': '0px',
'mso-hide' : 'all',
'width' : '0px',
'max-width' : '0px'
};
var style_text = '';
$.each(styleCSS, function(k,v) {style_text += k+':'+v+';';});
$('.container').find('.hide-me').attr('style', style_text);
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container">
<div class="hide-me">foo</div>
<div>bar</div>
</div>
&#13;
答案 1 :(得分:0)
使用jQuery还有什么其他解决方案?
另一种方法是将var styleCSS
声明为字符串变量(而不是对象),然后通过jQuery将另外的<style>
元素附加到文档的<head>
:
$(document).ready(function(){
var styleCSS = '.hide-me {display: none; height: 0; line-height: 0; max-height: 0; overflow: hidden; font-size: 0; mso-hide: all; width: 0; max-width: 0;}';
$('head').append('<style>' + styleCSS + '</style>');
});