我正在尝试学习url持久化,一个朋友告诉我要学习这段代码:
$(document).ready(function(){
var objects = {};
var DEFAULT_LOCATION = "diameter";
$("#animateObjects").hide();
var urlDimension = location.hash.replace("#","");
if (urlDimension.length == 0) {
// location.hash = "#" + DEFAULT_LOCATION;
urlDimension = DEFAULT_LOCATION;
$("#"+DEFAULT_LOCATION).addClass("active");
clog("started with no dimension, defaulted to " + DEFAULT_LOCATION);
}
else {
$("#"+urlDimension).toggleClass("active");
clog("started with dimension: " + urlDimension);
}clog()方法完成了什么?
完整的代码是here。
发布于 2012-07-31 09:06:04
我敢打赌这是一个围绕console.log的包装器,以迎合IE无法处理它的情况。
如下所示:
function clog(message) {
try {
console.log('message');
}
catch (ex) {}
}参考:http://benwong.me/javascript-console-log-and-internet-explorer/
https://stackoverflow.com/questions/11731736
复制相似问题