-
AuthorPosts
-
December 8, 2016 at 8:34 pm #722157
I want to reduce the sticky header size on page: http://physio.netzhautflimmern.ch/
thanxDecember 8, 2016 at 9:15 pm #722175Hey netzhautflimmern,
Unfortunately it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However if its really important for you to get this done, you can always hire a freelancer to do the job for you :)
Best regards,
BasilisDecember 8, 2016 at 9:30 pm #722186Was ist mit diesem Rätselwort gemeint.
Das Verhältnis von Ausgangsgröße zu geschrumpfter Größe ist schon beeinflussbar:in avia.js line 1618 da ist die Zeile:
newH = el_height/2;
https://kriesi.at/support/topic/controling-the-size-of-shrinking-header/
schau da mal nach – ich habe es noch nicht getestet
- This reply was modified 7 years, 11 months ago by Guenni007.
December 8, 2016 at 10:48 pm #722221i don’t know where the point is and why it does not work – the concerning code is in avia.js:
if(shrinking && !isMobile) { if(st < el_height/2) { newH = el_height - st; if(st <= 0){ newH = el_height; } av_change_class(header, 'remove', 'header-scrolled'); //header.removeClass('header-scrolled'); } else { newH = el_height/2; //header.addClass('header-scrolled'); av_change_class(header, 'add', 'header-scrolled'); } if(st - 30 < el_height) { av_change_class(header, 'remove', 'header-scrolled-full'); } else { av_change_class(header, 'add', 'header-scrolled-full'); } elements.css({'height': newH + 'px', 'lineHeight': newH + 'px'}); logo.css({'maxHeight': newH + 'px'}); }
- This reply was modified 7 years, 11 months ago by Guenni007.
December 8, 2016 at 10:55 pm #722225Hey!
Please go to enfold/js/avia.js file and find
newH = el_height/2;
and
if(st < el_height/2)
and change 2 as needed
If you are using a child theme – http://kriesi.at/documentation/enfold/using-a-child-theme/, please add following code to Functions.php file of your child theme
function wp_change_aviajs() { wp_dequeue_script( 'avia-default' ); wp_enqueue_script( 'avia-default-child', get_stylesheet_directory_uri().'/js/avia.js', array('jquery'), 2, true ); } add_action( 'wp_print_scripts', 'wp_change_aviajs', 100 );
and move modified file inside /js folder
Cheers!
YigitDecember 9, 2016 at 10:22 am #722364i tried that – because in my remembering i did that allready a few month ago. But on one installation (all on latest updates Enfold and WP) on scrolling down ( f.e. 3 is set in for the 2) there are strange reactions on that.
On that test i had set the header height to 300px ( the same on not so extreme values – but calculating is much easier)
on reaching 200px ( the addition of class header-scrolled happend (2/3 ???) ) and the logo height than jumps to 1/3 of 300px (the setting)we have to think about the code because it only works with 2 – Why? : because scroll distance is on that point of change the rest of the distance to top is equal to scrolling-down distance 150px
but see case above with 3 – scrolling down 100px ( the distance to top is 200px)
so here is my quintessence: you have to set the first value to 1.5 and the second to 3
the scroll distance when the jump to the additional class must be on that point when it reaches the header height end point
the header should end at 100px (1/3) so we have to subtract 200px ( and 200px are 2/3 of starting header height! – on that code you have to take the reciprocal value 3/2 = 1.5see here: http://webers-testseite.de/ikom/
so this is the code ( from line 1604 of avia.js) on that :
if(shrinking && !isMobile) { if(st < el_height/1.5) { newH = el_height - st; if(st <= 0){ newH = el_height; } av_change_class(header, 'remove', 'header-scrolled'); //header.removeClass('header-scrolled'); } else { newH = el_height/3; //header.addClass('header-scrolled'); av_change_class(header, 'add', 'header-scrolled'); }
- This reply was modified 7 years, 11 months ago by Guenni007.
December 9, 2016 at 10:44 am #722369by the way here is the code to change if you have increased top-bar height (social bookmarks height)
on line 1623 :
if(st - 30 < el_height)
this is standard given top-bar height.
if you do not change here the 30 the main container is on starting already under the headersee here i increased the top-bar height to 40px (instead of 30 normal value)
December 11, 2016 at 12:12 pm #722817PS i changed it to a big amount of shrinking for another thread here on forum and placed an absolute Button above the logo – for you it is important to see only the logo under that button.
( it is nowif(st < el_height/1.01)
andnewH = el_height/3;
)- This reply was modified 7 years, 11 months ago by Guenni007.
December 13, 2016 at 4:41 pm #723805thank you all very much, that worked for me!!
December 13, 2016 at 5:10 pm #723828one more question… in IE and edge the sticky header looks really weird, totally pixeled and not sharp.. firefox everything normal..
December 13, 2016 at 9:52 pm #723994Hey!
Can you please try adding following code to Quick CSS and check if it helps?
.logo img { -ms-interpolation-mode: bicubic; }
Regards,
YigitDecember 13, 2016 at 11:12 pm #724020did you read it carefully? i can see that your logo jumps after scrolling to its end height, and transparency has strange behavior – so try the values noted on the code
your header starts at 220px (custom value) you want to end at 95px (?) so the distance you have to scroll for changing class of the header is 125px
if(shrinking && !isMobile) { if(st < el_height/1.76) { newH = el_height - st; if(st <= 0){ newH = el_height; } av_change_class(header, 'remove', 'header-scrolled'); //header.removeClass('header-scrolled'); } else { newH = el_height/2.31; //header.addClass('header-scrolled'); av_change_class(header, 'add', 'header-scrolled'); }
because 220/1.76 = 125
and 220/2,31 = 95,23that means – after scrolling down 125px the new Header Height is at its endpoint of 95px
December 14, 2016 at 3:30 pm #724313these two values are only the same for value 2 because scroll way and shrinked height of the header are only on that case the same.
i can see it in your avia.js – that you have set both to the same Quotient
December 15, 2016 at 12:05 am #724669I did both, changed the numbers and added the css, but it didnt change anything..
December 15, 2016 at 12:07 pm #724832i’m talking about the shrink process – the pixalized logo is the other question.
Now you did change both values – and the shrinking is now fluently with no jump to an endpoint.
i do not see how you influenced transparency on scrolling
i changed the frontpage to transparency and glassy like you had. And there is no fluctuation on transparency amount.
because see here: http://webers-testseite.de/ikom/you can influence the change point on avia.js a bit more down (line 1650ff) ( default value is 50 – i changed it in the example above to 100)
so after 100px scrolling the transparency of the glassy header goes to its given opacitybut on your installation there is a “little pulsation” i don’t know where it comes from
if(transparent) { if(st > 100) { //header.removeClass('av_header_transparency'); av_change_class(header, 'remove', 'av_header_transparency'); } else { //header.addClass('av_header_transparency'); av_change_class(header, 'add', 'av_header_transparency'); } }
December 16, 2016 at 1:02 am #725110I’m not talking about the transparency.. I’m talking about the sticky header logo, that is totally pixeled..
December 16, 2016 at 1:08 am #725113Hi!
Have you tried the code i posted here? If that did not help, please let me know so i can ask my teammates who are using IE to check your site :)
Regards,
YigitDecember 19, 2016 at 5:58 pm #726164yes, I tried the code but it didnt work..
December 22, 2016 at 4:31 pm #727575Hi,
I will ask my teammates to check once again, please kindly wait to hear from them.
Best regards,
YigitApril 26, 2018 at 2:22 pm #947289Hi, i have the same problem.
I’m using a childtheme and added this code in my function.php/* Sticky-Header */ function wp_change_aviajs() { wp_dequeue_script( 'avia-default' ); wp_enqueue_script( 'avia-default-child', get_stylesheet_directory_uri().'/js/avia.js', array('jquery'), 2, true ); } add_action( 'wp_print_scripts', 'wp_change_aviajs', 100 );
I copied the avia.js in my childtheme folder childtheme/js/avia.js and added this code:
//check if the browser supports element rotation function avia_header_size() { var win = $(window), header = $('.html_header_top.html_header_sticky #header'), unsticktop = $('.av_header_unstick_top'); if(!header.length && !unsticktop.length) return; var logo = $('#header_main .container .logo img, #header_main .container .logo a'), elements = $('#header_main .container:not(#header_main_alternate>.container), #header_main .main_menu ul:first-child > li > a:not(.avia_mega_div a, #header_main_alternate a), #header_main #menu-item-shop .cart_dropdown_link'), el_height = $(elements).filter(':first').height(), isMobile = $.avia_utilities.isMobile, scroll_top = $('#scroll-top-link'), transparent = header.is('.av_header_transparency'), shrinking = header.is('.av_header_shrinking'), topbar_height = header.find('#header_meta').outerHeight(), set_height = function() { var st = win.scrollTop(), newH = 0, st_real = st; if(unsticktop) st -= topbar_height; if(st < 0) st = 0; if(shrinking && !isMobile) { if(st < el_height/1.5) { newH = el_height - st; if(st <= 0){ newH = el_height; } av_change_class(header, 'remove', 'header-scrolled'); //header.removeClass('header-scrolled'); } else { newH = el_height/3; //header.addClass('header-scrolled'); av_change_class(header, 'add', 'header-scrolled'); } if(st - 30 < el_height) { av_change_class(header, 'remove', 'header-scrolled-full'); } else { av_change_class(header, 'add', 'header-scrolled-full'); } elements.css({'height': newH + 'px', 'lineHeight': newH + 'px'}); logo.css({'maxHeight': newH + 'px'}); } if(unsticktop.length) { if( st <= 0) { if(st_real <= 0) st_real = 0; unsticktop.css({"margin-top":"-"+st_real+"px"}); } else { unsticktop.css({"margin-top":"-"+topbar_height+"px"}); } } if(transparent) { if(st > 50) { //header.removeClass('av_header_transparency'); av_change_class(header, 'remove', 'av_header_transparency'); } else { //header.addClass('av_header_transparency'); av_change_class(header, 'add', 'av_header_transparency'); } } }; if($('body').is('.avia_deactivate_menu_resize')) shrinking = false; if(!transparent && !shrinking && !unsticktop.length) return; win.on( 'debouncedresize', function(){ el_height = $(elements).attr('style',"").filter(':first').height(); set_height(); } ); win.on( 'scroll', function(){ window.requestAnimationFrame( set_height )} ); set_height(); }
But it doesn’t work.
Any ideas?
Thank you.April 26, 2018 at 3:16 pm #947314can you please see here that little tut. ( i will have look if on Enfold 4.3 has changed something – but i guess not)
to have not the whole avia.js changed – it works with a separated shrink-fix.js etc. the whole thing is here :
https://kriesi.at/support/topic/shrinking-of-header-amount-an-info/Edit:.. i see new Enfold has extracted that code to : avia-snippet-sticky-header.js
it is not part of avia.js anymore –
So we need a new workaround to replace this avia-snippet-sticky-header.js through a child-theme one.
This seems to be easier as before because it is now nearly the same as if we had a shrink-fix.jsYigit : how can we load that child-theme pendent ( the formula stayes the same – there are two values to change)
it is loaded via functions.php via:
//sticky header with header size calculator $condition = (isset($options['header_position']) && $options['header_position'] == "header_top"); $condition2 = (isset($options['header_sticky']) && $options['header_sticky'] == "header_sticky") && $condition; avia_enqueue_script_conditionally( $condition2 , 'avia-sticky-header', $template_url."/js/avia-snippet-sticky-header.js", array('avia-default'), $vn, true);
is there a way to have that functions.php of the parent-theme condition integrated
in other words – what happend if shrinking is not activated on Enfold settings – then the script is loading allthough it is not needed.
how can we avoid that on performance reasons. ( – yes i know : not to place that on child-theme )April 26, 2018 at 3:41 pm #947322what makes me wonder is that it works the old way on a test site with new Enfold 4.3 ?
I would have assumed, first, to deregister the parent function
Edit: i did it this way now – seems to work:
add_action( 'wp_enqueue_scripts', 'wp_change_sticky_header_script', 100 ); function wp_change_sticky_header_script() { wp_deregister_script( 'avia-sticky-header' ); wp_enqueue_script( 'avia-sticky-header-child', get_stylesheet_directory_uri().'/js/avia-snippet-sticky-header.js', array('avia-default'), $vn, true); }
and then upload an edited avia-snippet-sticky-header.js to child-theme/js/ folder
April 26, 2018 at 3:56 pm #947327@designereck – edit: it seems not to work because Enfold 4.3 has changed hierarchical structure
Read the answer before.if you want to shrink not so much – than your values are right.
f.e Start from 300px to reach 200px
first value 3 last value 1.5April 26, 2018 at 4:42 pm #947346@Guenni007
Wenn es okay ist antworte ich lieber auf Deutsch.Die Werte sind nur Testwerte gewesen, um zu schauen ob es klappt. Wenn ich alles richtig verstanden habe, dann muss ich als Startwert 1.56 und als Zielwert 2.8 eingeben. Ich starte nämlich bei 280px und möchte bei 100px enden.
Ich habe nun folgendes in die function.php eingetragen:
add_action( 'wp_enqueue_scripts', 'wp_change_sticky_header_script', 100 ); function wp_change_sticky_header_script() { wp_deregister_script( 'avia-sticky-header' ); wp_enqueue_script( 'avia-sticky-header-child', get_stylesheet_directory_uri().'/js/avia-snippet-sticky-header.js', array('avia-default'), $vn, true); }
Und folgendes in die kopierte avia-snippet-sticky-header.js im Ordner enfold-child/js/…:
if(shrinking) { if(st < el_height/1.5) { newH = el_height - st; if(st <= 0){ newH = el_height; } av_change_class(header, 'remove', 'header-scrolled'); //header.removeClass('header-scrolled'); } else { newH = el_height/2.8; //header.addClass('header-scrolled'); av_change_class(header, 'add', 'header-scrolled'); }
Leider klappt es nicht. Oder muss ich die komplette avia-snippet-sticky-header.js Datei kopieren und nur die Werte ändern?
Habe jetzt im Moment nur eine .js Datei mit dem entsprechenden Namen angelegt und den Code hineinkopiert.
Danke dir für die Hilfe!April 26, 2018 at 5:55 pm #947373ja nimm unbedingt nur die komplette datei – ohne initialisierung geht es nicht.
Ist ja nur 4.3kb großdas war nur der Ausschnitt der verändert wird.
nimm ruhig zweistellig also 1.56 und 2.8 – werte waren korrekt ( edit: natürlich mit Punkt nicht mit Komma)heißt eben sobald 180px gescrollt wurden, erreicht man den Endpunkt der header-höhe. (100px)
st war ja definiert worden in der Datei als $window.scrollTop( )April 26, 2018 at 6:51 pm #947408Super, danke dir!
Werde es morgen früh sofort testen und dann Bescheid geben.
Danke und schönen Abend noch!- This reply was modified 6 years, 7 months ago by designereck.
April 26, 2018 at 8:05 pm #947445Ach noch eines im Nachgang :
this line:
if(shrinking && !isMobile)
if you change it to :
if(shrinking)
the shrinking works on ipad f.e. too-
don’t know why it is set on thatApril 27, 2018 at 8:40 am #947716Moin!
Danke erst mal für den ganzen Support!
Leider klappt es immer noch nicht. Habe jetzt die komplette .js Datei genommen und nur die Werte geändert. Leider tut sich da immer noch nichts. Die Höhe bleibt bei 130px. Ist das ein Unterschied, wenn ich lokal mit MAMP arbeite? Sollte doch eigentlich nicht?!EDIT
Wenn ich die Werte in der .js Datei im Haupttheme Ordner ändere funktioert es perfekt …- This reply was modified 6 years, 7 months ago by designereck.
April 27, 2018 at 9:02 am #947726Also:
1) die datei : avia-snippet-sticky-header.js aus deinem gedownloadeten Enfold Ordner nehmen, und deinen Wünschen nach bearbeiten.
2) Die Datei in deinen Ordner enfold-child/js/ legen (keine Ahnung wo der bei Mamp sich befindet.
3) Im Enfold-Child Optionen Dialog sollte schon auch shrinking header gewählt sein, und die Starthöhe von 280px eingestellt sein (weshalb mich schon hier wundert warum du nicht bei 140px Endwert landest.
4) in deiner Child-Theme functions.php das hier hineinkopieren:add_action( 'wp_enqueue_scripts', 'wp_change_sticky_header_script', 100 ); function wp_change_sticky_header_script() { wp_deregister_script( 'avia-sticky-header' ); wp_enqueue_script( 'avia-sticky-header-child', get_stylesheet_directory_uri().'/js/avia-snippet-sticky-header.js', array('avia-default'), $vn, true); }
5) Schauen ob irgendwo (Enfold hat auch jetzt implementiert) einige Minimizer laufen (BWP-Minify etc oder Caching-Tools) –
Cache überall auch am Browser löschen.
6) Nachschauen ob der gewünschte Endpunkt von 100px erreicht wird.April 27, 2018 at 11:56 am #947890Hallo Guenni007,
vielen vielen Dank!Ich habe es über Umwege hinbekommen. Die .js Datei wird/wurde nicht im Child Ordner angesprochen. Habe dann die Änderung im Parent Theme Ordner gemacht, in den Child Ordner kopiert und dann wieder im Parent Ordner zurück geändert. Es laufen keine Minimizer oder Cachingtools. Für mich irgendwie nicht alles verständlich. Zumal ich deine Liste genau abgearbeitet habe und meine style.css läuft ja auch. Aber es läuft jetzt!
Bin nur mal gespannt, es das noch tut, wenn ich es online bringe, oder mal ne Nacht drüber schlafe …
Auf jeden Fall vielen Dank für deine Geduld und deine Hilfe!
Falls es, aus welchen Gründen auch immer, nicht mehr funktioniert melde ich mich noch mal.EDIT
Es funktioniert wirklich nur, wenn ich die Werte im Parent Theme änder.- This reply was modified 6 years, 7 months ago by designereck.
-
AuthorPosts
- You must be logged in to reply to this topic.