joomfreak-logo

It's time to pass this project on to someone passionate about continuing its journey. joomfreak offers a unique opportunity to build upon a well-established platform and keep providing the Joomla community with quality templates and tools.

If you're interested, we'd love to hear from you!
Contact us

VISIT AND LIKE OUR PAGE ON FACEBOOK
TAKE A LOOK AT OUR TWEETS ON TWITTER
SUBSCRIBE TO THE JOOMFREAK RSS FEED
VISIT OUR CHANNEL ON YOUTUBE

Account Details

Change your name, email, password or permanently delete your account. Change settings

We offer several ways you can get support from our experts: Support ForumKnowledgebaseNewsletter

Your Forum Posts

No posts to display.

Welcome, Guest
Username Password: Remember me

the slow scroll effect on anchor link
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: the slow scroll effect on anchor link

the slow scroll effect on anchor link 23 Sep 2017 09:40 #10611

To create the slow scroll effect on anchor links
I tried to
enter in jf_salina\scripts\js\template.js
this code

 
// SCROLL //
menuItems = $(".nav ul.nav > li > a");
menuItems.click(function(e){
$(".nav ul.nav > li").removeClass('active');
$(this).parent().addClass('active');
 
var href = $(this).attr("href"),
offsetTop = href === "#" ? 0 : $(href).offset().top-topMenuHeight+12;
$('html, body').stop().animate({
scrollTop: offsetTop
},800);
 
e.preventDefault();
});
// \. SCROLL //
 
 


but it does not work

maybe something else is missing?

  • Posts:7
  • maxmak
  • Fresh Boarder
  • OFFLINE
  • Karma: 0

Re: the slow scroll effect on anchor link 23 Sep 2017 15:16 #10612

resolved here is the working code


 
// SCROLL //
topMenu = $(".header-bottom");
topMenuHeight = topMenu.outerHeight();
menuItems = $(".nav ul.nav > li > a");
menuItems.click(function(e){
$(".nav ul.nav > li").removeClass('active');
$(this).parent().addClass('active');
 
var href = $(this).attr("href"),
offsetTop = href === "#" ? 0 : $(href).offset().top-topMenuHeight+12;
$('html, body').stop().animate({
scrollTop: offsetTop
},800);
 
e.preventDefault();
});
// \. SCROLL //
 
 

  • Posts:7
  • maxmak
  • Fresh Boarder
  • OFFLINE
  • Karma: 0
  • Page:
  • 1
Time to create page: 0.58 seconds
Wednesday 30 April 2025

joomfreak is not affiliated with or endorsed by the Joomla Project or Open Source Matters.
The Joomla logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.