[英]Change CSS value when page has loaded?
Is it possible to change a value of a css style after the page has finished loading? 页面加载完成后是否可以更改css样式的值?
For example I need to change a division that is display:block
to display:none
after the page has finished loading? 例如,我需要在页面完成加载后更改
display:block
的分区display:block
display:none
分区?
Is this possible in jQuery and if so how do I implement it? 这在jQuery中是否可行,如果是这样,我该如何实现它?
Checkout the ready()
event, and the css()
method. 检查
ready()
事件和css()
方法。
Look at the list of possible selectors to see how to target your element. 查看可能的选择器列表,了解如何定位元素。
$(document).ready(function () {
$('selectorForYourElement').css('display', 'none');
});
:gt()
selector, or use the slice()
method (preferred).
:gt()
选择器组合使用,也可以使用slice()
方法(首选)。
$(document).ready(function () {
$('selectorForYourElement').slice(1).css('display', 'none');
});
Or 要么
$(document).ready(function () {
$('selectorForYourElement:gt(0)').css('display', 'none');
});
$('selector').css({
display: 'none'
});
给块一个id fe hideMe并在jQuery中执行此操作:
$(document).ready(function(){$("#hideMe").hide();});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.