foundation / foundation-sites

The most advanced responsive front-end framework in the world. Quickly create prototypes and production code for sites that work on any kind of device.
https://get.foundation
MIT License
29.66k stars 5.48k forks source link

Off Canvas 2 Links #728

Closed adamfairhead closed 11 years ago

adamfairhead commented 12 years ago

I'm experiencing a error that logs whenever I attempt to click any of the links once revealed in the off canvas 2 example. That error is:

TypeError: 'null' is not an object (evaluating '$target.offset($.top')

This error is preventing me from following any of the links. Any ideas why this might be?

jasonkendall commented 12 years ago

I had/have the same issue (https://github.com/zurb/foundation/issues/641). I wound up just writing my own jquery but if you do find a solution, please post it.

steven-noble commented 12 years ago

I'm experiencing the same issue with off canvas. Clean download, added in some hyperlinks and they don't go anywhere. Hopefully this gets fixed as I want to use it for one of my current projects.

siraskalot commented 12 years ago

I can confirm I have the same issue! (Also with the example pages you provide in the download).

awshout commented 12 years ago

e.preventDefault(); in the following code from jquery.offcanvas.js is preventing the links from working.

$('#nav li a').on(events, function(e) {
        e.preventDefault();
        var href = $(this).attr('href'),
        $target = $(href);
    $('html, body').animate({scrollTop : $target.offset().top}, 300);
});

Typically that's to prevent an id from being added to the end of the url in a case like < a href="#id">

siraskalot commented 12 years ago

Since I am using ajax to replace the "main content", as a temporary solution, I've commented out the above code @awshout mentioned, and run ...

$('body').removeClass('active-menu');

... after the ajax call returns successfully.

hatefulcrawdad commented 11 years ago

Removed that preventDefault, it didn't seem as if it was even really needed for things to work properly.