0

I came into an issue where I thought all of my links containing anchor bookmarks (ie: "/index.php#top") were not working with FireFox. I came to the conclusion that there is some JavaScript within the Joomla 2.5 template I am developing that is killing off all of my links within my pages that contain hash marks (making them not go anywhere).

To see what I am talking about, here is my template that is working correctly: http://www.lawsonsp.com/ink-information/textile-plastisol-inks?jtpl=8

and here is my template containing the issue: http://www.lawsonsp.com/ink-information/textile-plastisol-inks?jtpl=9

On this page (on both templates) the image links at the top of the main content should link down to their corresponding sections below (ie: "#white")

How do I go about diagnosing WHICH Javascript code is killing the links containing hash marks? (preferably with FireFox, but with any method would be appreciated)

nhartsog
  • 45
  • 1
  • 5

2 Answers2

0

I recently had to tackle this exact problem. I found using jQuery to listen for and manage the event was the most effective solution. Here is a sample of the code I used:

JHtml::_('jquery.framework');

jQuery(document).on('click', '#go-to-my-anchor', function(e) {
    e.preventDefault();
    window.location.hash = '#my-anchor';
});
Brian Bolli
  • 1,873
  • 1
  • 12
  • 14
  • Thanks for the response @user3295190, but I feel that I am too unfamiliar with JS coding that I'm not even sure where to put this code to implement... – nhartsog Feb 19 '14 at 16:24
0

I found that, in the lower section of the jqm.init.js file, some settings are initialized and/or deactivated before JQuery mobile is loaded. A couple of these lines are commented out by default, and I found two that correspond to handling links with a hash like in my issue.

I've made sure the following lines are uncommented to allow normal link handling by the browser instead of JQuery (I'm pretty sure)

$(document).bind("mobileinit", function() {
   ...
   $.mobile.linkBindingEnabled = false;
   $.mobile.hashListeningEnabled = false;
   ...
});

If anyone sees a problem with this, please let me know as I am admittedly new to JS coding...

nhartsog
  • 45
  • 1
  • 5