Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
denniserdmann committed Feb 26, 2021
1 parent c1cc3d4 commit 5e3ec1d
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/Resources/contao/templates/j_onepage_navigation.html5
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<script>
$(document).ready(function() {
var el = $('a[href*="#"]').not('[href="#"]').not('[href="#0"]');
var scrollSpeed = 800;
var scrollSpeed = 800;
var uri = window.location.href.split("#")[0];

el.click(function(event) {
// check if On-page links
if (
Expand All @@ -30,7 +30,7 @@ $(document).ready(function() {
// set nav active when scrolling
var navActive = function(section) {
var $el = $('.onepage_navigation__list');

$el.find('li.active').removeClass('active');
$el.each(function(){
$(this).find('a[data-onepagelink="'+section+'"]').parent().addClass('active');
Expand All @@ -39,9 +39,9 @@ $(document).ready(function() {

var navigationSection = function() {
var $section = $('.mod_article');

$section.waypoint(function(direction) {

if (direction === 'down') {
if($(this.element).hasClass('onepage_article')) {
// change url to active link
Expand All @@ -53,27 +53,27 @@ $(document).ready(function() {
});

$section.waypoint(function(direction) {

if (direction === 'up') {
var previousWaypoint = this.previous();

if($(this.element).hasClass('onepage_article')) {
// change url to active link
navActive(this.element.id);
}
}
}

}, {
offset: function() {
return (this.context.innerHeight()/2) - this.element.offsetHeight; // offset 50% from bottom
},
group: $section
});
};

$(function(){
navigationSection();
});
});

});
</script>

0 comments on commit 5e3ec1d

Please sign in to comment.