有问题......
$(document).ready(function() {
var n = '#nav', no = 'nav-open';
$('#nav-menu').click(function() {
if ($(n).hasClass(no)) {
$(n).animate({height:0},300);
setTimeout(function(){
$(n).removeClass(no).removeAttr('style');
},320);
}
else {
var newH = $(n).css('height','auto').height()
;
$(n).height(0).animate({height:newH},300);
setTimeout(function(){
$(n).addClass(no).removeAttr('style');
},320);
}
});
});
我想这没有任何的运气:
var ready;
ready = function() {
...your javascript goes here...
};
$(document).ready(ready);
$(document).on('page:load', ready);
对不起,我没用的JavaScript!
为什么这不适合你?你有没有检查控制台的错误? –
你的代码工程http://jsfiddle.net/mr4C4/ – Max
@max,问题不在于代码不起作用 - 这是因为TurboLinks,即使你进入不同的页面,基本上也能保持加载;令人困惑的JS –