Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #904350

    Dear Kriesi Team,
    The second time, i have to write this post, because my other one dissapeared in nirvana….
    Ok, again.

    We have a Website with multiple pages, using the wonderful Enfold Theme. We have links to anchors on those pages, and we jump between the pages to certain anchors. In Firefox, the jumps are not correct, it jumps too far most of the time

    I am on Page A and want to jump to the anchor #hiring set on Page B (from example.com/pageA => example.com/pageB#hiring)

    this is how it should look like (and how it looks like in chrome, safari)
    https://www.pic-upload.de/view-34749635/hiring_ok.png.html

    this is how it looks like in firefox
    https://www.pic-upload.de/view-34749486/hiring_wrong.png.html
    (firefox jumps a bit too far within the page. This distance is exactly the distance of the fixed header (62px)

    – The problem is somewhere here (avia.js, line 731 – 747), please have a look to the alert, i put there

    			if (fixedMainPadding > 0 && hash && apply_to_container == 'body' && hash.charAt(1) != "!" && hash.indexOf("=") === -1)
    			{
    				var scroll_to_el = $(hash), modifier = 0;
    				
    				if(scroll_to_el.length)
    				{
    					the_win.on('scroll.avia_first_scroll', function()
    					{	
                                                    alert("test");
    						setTimeout(function(){ //small delay so other scripts can perform necessary resizing
    							if(sticky_sub.length && scroll_to_el.offset().top > sticky_sub.offset().top) { modifier = sticky_sub.outerHeight() - 3; }
    							the_win.off('scroll.avia_first_scroll').scrollTop( scroll_to_el.offset().top - fixedMainPadding - modifier );
    							
    						},10); 
    				    });
    			    }
    			}

    if the alert pops up, the jumping to the ID works perfect. The alert pops up: all the time in Chrome and Safari, sometimes in Firefox and all the time, when i am logged in as ADMIN in Firefox. When it does not pop up, the jump does not work correcty and the header overlaps some of the color section (with the ID used as anchor)

    Now the funny stuff:
    – sometimes, it works properly in Firefox as well. I cannot see any pattern, why or how often it works
    – in Safari and Chrome and even mobile, it works like it should be (no rocketscience)
    – when i am logged in as ADMIN User in wordpress, the jump to the anchor in firefox works all the time perfectly

    hope you can help, because i spent more than 7 hours now to find out some solution, tried all css-fixed i could find but nothing worked properly the right way. THIS IS A BUG, in my opinion, but i dont know where to find it.

    I delete ALL of my custom CSS AND deactived all plugins. Did not help.

    thanks in advance
    bici

    • This topic was modified 6 years, 10 months ago by spielprinzip.
    #904980

    ok, i created a testcase and i finally found the error.

    change the code in avia.js to the following (line 736 ff):

    if(scroll_to_el.length)
    				{
    					//firefox most of the time does ignore the offset of the fixed header
    					var jumpAccomplished = false;
    					
    					the_win.on('scroll.avia_first_scroll', function()
    					{	
    						jumpAccomplished = true;
    						setTimeout(function(){ //small delay so other scripts can perform necessary resizing
    							if(sticky_sub.length && scroll_to_el.offset().top > sticky_sub.offset().top) { modifier = sticky_sub.outerHeight() - 3; }
    							the_win.off('scroll.avia_first_scroll').scrollTop( scroll_to_el.offset().top - fixedMainPadding - modifier );
    							
    						},10); 
    				    });
    					// firefox igrnored the offset... 62 is the height of the fixed header. fit to your needs.we do the scrolling by ourselfes.
    					if(!jumpAccomplished){
    						$('html, body').animate({scrollTop: $(hash).offset().top -62 }, 'slow');
    					}
    			    }

    should be self explaining.

    • This reply was modified 6 years, 10 months ago by spielprinzip.
    #905166

    Hi,

    You can also load the avia.js form a child theme, so you can keep that there and not loose it on updates!

    Best regards,
    Basilis

    #905169

    Hi Basilis,

    thanks, i did that and it works like a charm.

    thanks, you can close the topic i think!
    bici

    #905994

    Hi Bici,

    Great, glad we could help. Please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Anchor Links to another page, fixed header. In firefox not working correctly’ is closed to new replies.