以下のフィドルで確認できる Jquery を作成しました: http://madaxedesign.co.uk/dev/Test/ http://jsfiddle.net/x82mU/1/
コード:
$(document).ready(function() {
var $root = $('html, body ');
$('.scroll a').click(function(e) {
var href = $.attr(this, 'href');
$root.animate({
scrollTop: $(href).offset().top
}, 500, function () {
window.location.hash = href;
});
return false;
});
// Responsive menu
$(function() {
var pull = $('#pull'),
menu = $('nav ul'),
menuHeight = menu.height()
$(pull).on('click', function(e) {
e.preventDefault();
menu.slideToggle();
});
$(window).resize(function(){
var w = $(window).width();
if(w > 320 && menu.is(':hidden')) {
menu.removeAttr('style');
}
});
});
});
しかし、それはこのエラーでうまくいきます: Uncaught TypeError: Cannot read property 'top' of undefined
これにより、次の Jquery が機能しなくなります。
誰かが理由を教えてくれるか、解決策を教えてくれるかどうか疑問に思っていましたか?
どうもありがとう