Problems with anchors and jQuery
Posted: Mon Feb 20, 2012 4:07 pm
I've seen other posts on this forum with similar issues, but none answer my particular problem.
I'm developing a tabbed navigation system on a website that uses CMSMS. There's a mockup page here:
http://www.care-plan-management-system. ... -contents/
The crucial bit are the green tabs in the centre column ("Domiciliary Care" etc). Depending on which tab is selected the content below the green line is swapped out. This is done using a simple jQuery script (Tabify).
I've got the whole build working on a local flat HTML version of the page - the tabs work as they should.
The problem comes when loading the code into CMSMS. As others have noted in this forum, CMSMS requires the use of the {anchor} tag to generate proper working anchor links. Otherwise the link will take you to the root URL. I've tried using the {anchor} tag on this page, and that solves the problem of redirecting the user to the home page, but it also breaks the Tabify script and the tab content no longer shows / hides as it should. (I assume this is because using {anchor} or any other method to insert a full URL in the href tag (ie. href="#tab1" becomes href="www.fullurl.com/#tab1") confuses the jQuery script. It will ONLY accept the hash without the preceding URL.)
If I was a jQuery developer I could probably adapt the Tabify script to get around this, but I'm not. To save me the trouble of either learning jQuery or getting a developer involved -- can anyone suggest a workaround from the CMSMS side? Is there any way I can disable this annoying "hijacking" of the anchor links that CMSMS insists on doing?
All suggestions most welcome!
I'm developing a tabbed navigation system on a website that uses CMSMS. There's a mockup page here:
http://www.care-plan-management-system. ... -contents/
The crucial bit are the green tabs in the centre column ("Domiciliary Care" etc). Depending on which tab is selected the content below the green line is swapped out. This is done using a simple jQuery script (Tabify).
I've got the whole build working on a local flat HTML version of the page - the tabs work as they should.
The problem comes when loading the code into CMSMS. As others have noted in this forum, CMSMS requires the use of the {anchor} tag to generate proper working anchor links. Otherwise the link will take you to the root URL. I've tried using the {anchor} tag on this page, and that solves the problem of redirecting the user to the home page, but it also breaks the Tabify script and the tab content no longer shows / hides as it should. (I assume this is because using {anchor} or any other method to insert a full URL in the href tag (ie. href="#tab1" becomes href="www.fullurl.com/#tab1") confuses the jQuery script. It will ONLY accept the hash without the preceding URL.)
If I was a jQuery developer I could probably adapt the Tabify script to get around this, but I'm not. To save me the trouble of either learning jQuery or getting a developer involved -- can anyone suggest a workaround from the CMSMS side? Is there any way I can disable this annoying "hijacking" of the anchor links that CMSMS insists on doing?
All suggestions most welcome!