-1
我有一个jquery,如果不挺的工作应该的方式发言,我觉得已经很接近了,但似乎并不十分想要的工作:jQuery的if语句格式
我就喜欢如下: 如果它是一个ios设备我希望它做一件事,如果它是一个高度大于500像素但小于830的窗口,那么做另一件事,如果它不是那些事情做第三件事
var deviceAgent = navigator.userAgent.toLowerCase();
var agentID = deviceAgent.match(/(iphone|ipod|ipad)/);
if(agentID) {
$("#about_container").css({
height: $(window).height() + 500
});
$("#about_main_header_container").css({
paddingBottom: (($(window).height() - $("#about_content_total").outerHeight(true)) /2) - 50
});
$("#services_wrapper").css({
height: $(window).height() + 190
});
$("#services_main_header_container").css({
paddingBottom: (($(window).height() - $("#services_container").outerHeight(true)) /2) - 10
});
}
else if ($(window).height() > 500, $(window).height() < 830) {
$("#about_container").css({
height: 830
});
$("#services_wrapper").css({
height: 830
});
$("#services_main_header_container").css({
paddingBottom: 160
});
$("#about_main_header_container").css({
paddingBottom: 130
});
}
else {
$("#about_container").css({
height: $(window).height() - 65
});
$("#about_main_header_container").css({
paddingBottom: (($(window).height() - $("#about_content_total").outerHeight(true)) /2) - 175
});
$("#services_wrapper").css({
height: $(window).height() - 100
});
$("#services_main_header_container").css({
paddingBottom: (($(window).height() - $("#services_container").outerHeight(true)) /2) - 175
});
}
...你想如何工作? – Codeman
你的问题是什么?你能否给我们更多关于“不太有效”的细节? –
如果它是一个ios设备我希望它做一件事,如果它是一个高度大于500像素但小于830的窗口,那么做另一件事,如果它们都不是这些东西做第三件事 – loriensleafs