Anchor links

Well-designed restaurant Joomla template with parallax effect.
GK User
Mon May 09, 2016 2:53 pm
Hi,
usually it is possible to link to some different page's anchor like "www.domain.com/#anchor" and the external page is opened on the anchor's place. But this is not possible on this template's menu. Anchors in menu are usable only on one page itself in way "#anchor". But I need to have menu working also from a subpage.
This is my case:

If you are here http://www.necozatajit.cz/z-medii and you want to get back on homepage and anchor http://www.necozatajit.cz/#obsazeni the button "Obsazeni" doesn't work on different pages then homepage. But the link "http://www.necozatajit.cz/#obsazeni" itself is working OK.

Exists a way how to achieve it? :dry:

Thank you for your help.
User avatar
Fresh Boarder

teitbite
Thu May 12, 2016 1:16 pm
Hi

Please send me an access to joomla panel. I'll see if full link can be activated.
User avatar
Moderator

GK User
Mon May 30, 2016 7:24 pm
SOLVED
Guys i found the solution. There is only small change needed in Java Script gk.scripts.js.
"e.preventDefault();" Must be moved a few rows down to be aplicated only on homepage. So it is working normally without scroll effect if the link with # is on some other page.

This is the working code:

jQuery('a[href*="#"]').on('click', function (e) {
if(this.hash !== '') {
if(this.hash !== '' && this.href.replace(this.hash, '') == window.location.href.replace(window.location.hash, '')) {
e.preventDefault();
var target = jQuery(this.hash);
if(target.length && this.hash !== '#') {
jQuery('html, body').stop().animate({
'scrollTop': target.offset().top
}, 1000, 'swing', function () {
if(this.hash !== '#') {
window.location.hash = target.selector;
}
});
}
}
}
});
User avatar
Fresh Boarder

teitbite
Sat Jun 04, 2016 9:37 am
Hi

Ok. Great to hear You've solve it. Closing this thread than.
User avatar
Moderator


cron
Remember me
Register New Account
If you are old Gavick user, click HERE for steps to retrieve your account.