VISIT AND LIKE OUR PAGE ON FACEBOOK
TAKE A LOOK AT OUR TWEETS ON TWITTER
SUBSCRIBE TO THE JOOMFREAK RSS FEED
CHECK OUT OUR PAGE ON GOOGLE +
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.70 seconds
Monday 19 November 2018

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.