javascript - Hash link disables relative link in HTML -


i'm building webapp one-page webapp link part of app this:

<a href="#internet"></a> 

this possible because used javascript contains animations , different stuff, problem somehow, method disables possibility link this:

<a href="internet/index.html"></a> 

how can have both links, without disabling hash links?

edit: honest dont know part of js causing behaviour because took template, here js:

https://github.com/gomobile/template-list-view/blob/master/www/lib/appframework/appframework.ui.min.js

i believe have code this

$('a').on('click', function(e) {    e.preventdefault();  });

you need have if

if ($(this).attr('href').indexof('#') == 0) {     e.preventdefault();  }

or better change selector to:

$("a[href^=#]").on('click', function(e) {      e.preventdefault();      // animation here.  });

this code apply anchor elements have href starting #

------- update --------

you added minified js :). if don't have problem in code, can fix hack this:

$('a:not([href^=#])').on('click', function(e) {     window.location.href = $(this).attr('href'); }); 

but should find issue, not fix :)


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -