加载页面时执行功能

Swe*_*etz 0 jquery function

$(window).bind("load", function() {
   $("#placeholder .flot-text .xAxis .tickLabel").css('height','90px','important');
});
Run Code Online (Sandbox Code Playgroud)

你好如何加载页面后立即执行此功能?仅当我刷新页面时才调用此函数,但我希望在加载页面时调用它.

Gau*_*164 5

像这样通过使用document.ready

$(document).ready(function(){     
    $("#placeholder .flot-text .xAxis .tickLabel").css('height','90px','important');
});
Run Code Online (Sandbox Code Playgroud)

或者你可以使用$(函数)之类的

$(function(){
    $("#placeholder .flot-text .xAxis .tickLabel").css('height','90px','important'); 
});
Run Code Online (Sandbox Code Playgroud)