Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery-mobile - how can I bind disable ajax links to a certain class

I working on a multicolumn layout in Jquery Mobile.

When the user opens a multicolumn page, I want to disable the JQM ajaxlinks navigation (and switch to "artificial navigation and history". So basically I'm trying to bind to a link or list item with a class name ="ui-hash-blocked". When the user leaves the page, I'm switching ajaxlinks back on.

I like the idea but cannot get this code to work (Error: $.mobile' [undefined])

$('.ui-hash-block').click(function ()
             {
             $.mobile.ajaxLinksEnabled = false;               
             });

Is there anything wrong with the syntax?

I know the error from calling $.mobile before initiating JQM, but since I'm only calling this function when the link/list item is clicked, JQM should have already been initiated.

Thanks for help & Merry Xmas!

Frequent

PS: if you need more code, I can put a up an example.

like image 580
frequent Avatar asked Dec 01 '22 09:12

frequent


1 Answers

Add data-ajax="false" to the link if you only want this behavior on certain links

like image 84
martin Avatar answered Dec 05 '22 02:12

martin