-
AuthorPosts
-
October 21, 2017 at 6:02 pm #867084
Hello,
I create a page with lots of AVIA modules
At the left : a 1/3 module with a “short” avia-icons-list
at the right : a 2/3 module with a loooonnng texte (in fact its a table but whatever)I’d like to STICK the icons list in the left part.
I tried 2 plugins but, as i’m not an expert, i can’t succeed to stick my 1/3 module with the icons list
thanks for your help
Cydut
- This topic was modified 7 years ago by Cydut. Reason: request from moderator
October 21, 2017 at 8:53 pm #867097Hey Cydut,
Can you please include a admin login in the private content area so we can take a closer look.Best regards,
MikeOctober 23, 2017 at 5:22 pm #867728This reply has been marked as private.October 25, 2017 at 3:54 am #868505Hi,
Please use “fixed_element” as the custom css class attribute of the column then add the following script in the functions.php file.
// custom script function add_custom_script(){ ?> <script type="text/javascript"> (function($){ function a() { $(window).scroll(function(e){ var sticky = $('.fixed_element'); var position = ($sticky.css('position') == 'fixed'); if ($(this).scrollTop() > 350 && !position){ $sticky.css({'position': 'fixed', 'top': '50px', 'width' : $sticky.innerWidth() }); $sticky.next().css('float', 'right'); $sticky.addClass('fixed_element_style'); } if ($(this).scrollTop() < 350 && position) { $sticky.css({'position': 'static', 'top': '0px', 'width' : '' }); $sticky.next().css('float', 'left'); $sticky.removeClass('fixed_element_style'); } }); } a(); })(jQuery); </script> <?php } add_action('wp_footer', 'add_custom_script');
Add this code in the Quick CSS field.
.fixed_element_style { z-index: 100; background: #f8f8f8; padding: 10px; }
This may require a few adjustments.
Best regards,
IsmaelOctober 26, 2017 at 8:00 pm #869306This reply has been marked as private.October 28, 2017 at 9:43 pm #870022Hi,
I logged in to make the changes for you but your Appearance > Editor is not showing, are you using a security plugin to block some features?
Anyways, first you will need to enable the custom css option:
Go to your Appearance > Editor > functions.php and look for this at the end of the file:// add_theme_support('avia_template_builder_custom_css')
remove the // and save.
Then go to your page and edit the column, you will see a new option box at the bottom “Custom Css Class”
add this to it:fixed_element
Then add the script above in the functions.php file and save
Then go to Enfold Theme Options > General Styling > Quick css , which is at the bottom of the page
and add the other code.
Best regards,
MikeOctober 29, 2017 at 8:28 pm #870202Hello,
once again thanks you (!!) for your help, unfortunately i’m encountering news issues (and my element is not sticked :-( )1/
I disactivated the isecurity plugin ==> now the Appearance > Editor is back (perhaps you can log and see it by yourself this time )
BUT i’m having the message (on http://www.seformer.fr/wp-admin/theme-editor.php) : asked Theme doesn’t not exist. Stylesheet is missing
for information : I use a child theme called “evryware”
I don’t know what to do solve this.2/
I followed the steps you gave me without the ‘Appearance > Editor’ way using FTP but i’m not sure in which ‘functions.php’ file I have to paste the Ismael Code (above). i did paste it in “wp-content/themes/enfold/functions.php”. Am I good with this choice ?again… thank you for you help
Best regards,
cydut
October 29, 2017 at 11:40 pm #870261var sticky = $('.fixed_element');
so i guess the $sticky is wrong in the rest of the function – or you setup
var $sticky = $('.fixed_element');
October 30, 2017 at 2:54 pm #870487for information : I use a child theme called “evryware”
https://kriesi.at/documentation/enfold/change-the-dynamic-css-file-name/
but if you have this in your “child-theme” called everyware :
/* Theme Name: Enfold Child Description: Childtheme fuer Enfold Version: 1.0 Author: Kriesi Author URI: http://kriesi.at Template: enfold */ /*Add your own styles here:*/
you don’t need to do anything i guess
but you can even rename the enfold folder to everyware and name your child-theme : everyware-childand this will be the propper use of Theme Name obfuscation
Than do this in Child-Theme style.css
/* Theme Name: everyware Child Description: Childtheme fuer everyware Version: 1.0 Template: everyware */
rename the enfold folder to evryware you can all do that via ftp !
and that to functions.php of your child-theme:
add_filter('avf_dynamic_stylesheet_filename', 'avia_change_filename'); function avia_change_filename(){ return 'everyware'; }
the code of Ismael comes too into child-theme functions.php – BUT ! he has to look over it – because there are some “slip of the pen” faults
October 30, 2017 at 5:18 pm #870584my recommendation: use for that very demanding point of a fixed positioning in floating systems a given script.
From my recherche point – there is no good plugin for it – but a few good jQuery scripts to solve the problematic.
The scroll event is something you have to be carefull with – not to overload site performance.
You have to think about – if you have long fixed column too ( longer than screen height ! how to view this content under the screen bottom of the fixed column!have a look to this site: https://webers-testseite.de/sticky-column/
if you scroll to bottom – the fixed positioning is gone to get the content in the left column too !you find the script on : https://github.com/EnzoMartin/Sticky-Element#readme
if you like this solution – i will show you how to load only for the given pages the sources. And to implement it in enfold.
October 30, 2017 at 9:47 pm #870652Hello,
Wahooo ! Well done with the missing $ in the script
The left is now sticky but the right column is going over the sticked left column
The webers-testseite is really what I need ! In fact, I need it, in lots of my pages, which have the same construction model.
I will gratefull if you could show me how to implement it in my site.
Concerning the child theme problem. I’m on it. I’ll let you know ^^
Best regards,
Cydut
October 30, 2017 at 10:43 pm #870659well the scripts you can download from the github link above – take the minimized one: Link
create a child-theme and in the child theme folder an js folder
upload that minimized script to this js folder.on your functions.php of your child theme insert:
function include_sticky_js_file() { if( is_page(30238) ) { wp_enqueue_script( 'stickyelement', get_stylesheet_directory_uri().'/js/jquery.stickyelement.min.js', array('jquery', 'avia-default'), 2, true ); } } add_action( 'wp_enqueue_scripts', 'include_sticky_js_file', 100 );
you see that i only embed the code where i need it. The other pages stay untouched because of performance reasons.
Allthough that little script only has 4kbNow you need the script for the implementation on the specific page:
the script has two (take some classes – this is easy to set on enfold) containers to observe
the container which is sticky – and the parent element. So i gave to the color-section (or whatever it is a class that i can select it easier and the same with the container which should remain sticky.See code for my test installation:
add_action( 'wp_footer', 'custom_sticky_script' ); function custom_sticky_script() { if( is_page(30238) ) { ?> <script type="text/javascript"> jQuery(document).ready(function(){ // With options jQuery('.sticky_element').sticky('#av_section_1 .entry-content-wrapper', { useTransition: false, animate: false, offset: 110 }); jQuery('.sticky_element2').sticky('#av_section_3 .entry-content-wrapper', { useTransition: false, animate: false, offset: 0 }); }); </script> <?php } }
you see on my testpage two containers which stay fixed so two codes for it
jQuery('.sticky_element').sticky('sticky_parent_container', { …
so on my testpage the column gets the class sticky_element (and sticky_element2)
and the direct parent container is adressed by me via#av_section_1 .entry-content-wrapper
thats all – you have to play with the offset value
October 30, 2017 at 10:49 pm #870662PS i tested a few minutes ago – it is ok if you do not adress only the direct parent you can take the color-section as surrounding container too:
add_action( 'wp_footer', 'custom_sticky_script' ); function custom_sticky_script() { if( is_page(30238) ) { ?> <script type="text/javascript"> jQuery(document).ready(function(){ // With options jQuery('.sticky_element').sticky('#av_section_1', { useTransition: false, animate: false, offset: 110 }); jQuery('.sticky_element2').sticky('#av_section_3', { useTransition: false, animate: false, offset: 0 }); }); </script> <?php } }
by the way – this code is the cleanest code – you can try other options as animate or delay etc. yourself
October 30, 2017 at 11:54 pm #870670hello again,
Sorry but the last part is too complicated for me
I imagine that I have to change #av_section in this part of the code jQuery(‘.sticky_element’).sticky(‘#av_section_1’, {…
and #av_section_3 in this part of the code jQuery(‘.sticky_element2’).sticky(‘#av_section_3’, {Am I good ? if yes where can i find the name of the container ?
In my page : I have 1) on the left : a 1/3 module and 2) on the right a 2/3 module. What are the name i should use ?regards,
Cydut
ps : you’re were speaking of a testing page ?- This reply was modified 7 years ago by Cydut.
October 31, 2017 at 9:19 am #870785Testing page is my page where i tested it for you if it will work: https://webers-testseite.de/sticky-column/
nearly every modern browser got his own “developer tools”.
on a lot of browsers hold the mouse over the element you want to inspect and press context menu button of your mouse (left button) on my magic mouse it is the left part of the active sensor field.
on that context menu there is something like inspect the element or only inspect.
on first use a window opens with the source code and some extra infos about css etc. – you can have that part of the window as an extra window separated from your frontend window. Now have a look what happens when you go with your mouse over the elements.https://streamable.com/s/5lhs9/xykcyp&iframe=true
there you can get what you want – all the classes and ids.
The html source code is on the left and well formated with cascaded styling – parents are allways more left – and on click to the little arrow the container opens and shows you the inner content.The realy clou on that is that you can edit on the right side the css virtually. Nearly allmost Changings are shown on your front end immediately.
click on image to enlarge – you will see that i virtually changed the color of that inputfield i’m writing on now:On Enfold the color-sections got ids with the pre-name av_section_ and a count (starting at 1)
October 31, 2017 at 9:38 am #870787if you are working on functions.php of your child-theme it is a good advice to have a working copy of it on your desktop.
if you make some mistakes on changing the code ( maybe a semikolon is missing or quotationmarks aren’t the right one etc. you will see a white screen and can not interact with your site.) you could alway playback the working copy via ftp to your site.___________
so now – as i said is if you have all done for implementation of the script.
That little script is written to have an element fixed within his surrounding container !
So you have to adress (select) two containers – the one which is fixed and the parent container of this element.this part of the script should be adjusted to your givings:
jQuery('.sticky_element').sticky('sticky_parent_container', { …
1) The parent container can be a class or an id etc. on Enfold it could be the id of the section: #av_section_1 2, 3, 4 etc.
2) the sticky_element should be a unique class ( on my test page above i used on the bottom that class vor the 2nd and 3rd Column – that is possible.
– so go and give a custom class to the column you like to have the fixed position. (f.e.: sticky_element1, sticky_element2 etc)the second code ( the first was the implementation of the script itself) for functions.php of your child-theme is than:
and this (second one) is that the script nows what to handle and how:add_action( 'wp_footer', 'custom_sticky_script' ); function custom_sticky_script() { ?> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery('.sticky_element1').sticky('#av_section_1', { useTransition: false, animate: false, offset: 85 }); }); </script> <?php }
October 31, 2017 at 10:18 am #870792to that script : it works with sticky element and surrounding parent. The fixed positioning is gone when sticky element reaches the bottom of the parent container. !
So you must do following containeres in a different f.e. color-section !!!
see now the test page i inserted in the same container a 1/1 under it – and this leads to something you don’t want to have.some words on sticky element – :
go and have a look to different devices if the effect works on all – espacially mobile browsers. Very often the page is than unusable.
For our script above we had to find a way to have normal behavior for responsive case ! This is possible – but performance will go down
Another intime process must prove if window width is less than f.e 768px
i think this should only be a gimmick to use on one page – the risk of losing users because of a low performance of the site is too high.October 31, 2017 at 2:06 pm #870846by the way: this js works with positioning relative and calculates the top position- so it might work on ipad, iphone too – but with jerk i suppose
in the meanwhile i rearanged it a bit : and inserted a width for that. But i dont know why the resize event does not work immediately.
$(window).on('load resize', function(){
On reloading the page it works – maybe a mod could help here
this is now for all pages – i do the rest if needed.add_action('wp_footer', 'include_sticky_values'); function include_sticky_values(){ ?> <script type="text/javascript"> (function($) { $(window).on('load resize', function(){ if ($(window).width() > 768) { /*** here comes the code to sticky element***/ $('.sticky_element').sticky('#av_section_1', { useTransition: false, animate: false, offset: 85 }); $('.sticky_element2').sticky('#av_section_3', { useTransition: false, animate: false, offset: 50 }); /*** here ended the code to sticky element***/ } }); })(jQuery); </script> <?php }
November 1, 2017 at 1:44 am #871041Dear Guenni007,
I’m sorry but I didn’t succeed :sad:
I know it can be too much to ask, but, can you give me a step by step procedure with files( with location), things to change ?thanks to you i know much more things, like inspector in the browser, having a functional child- theme (I kept the originals names I had Enfold (parent) and evryware (child)) with custom CSS lines and make copies of files before working on them
BUT…. I’m still a newbie (script ? containers ? var ?)I hope I can count on you, once again wiht this page
Thanks by advance
Cydut
ps : and pleaaaaase, don’t look at the others pages – optimisation, is a second step for me. / streamable is cool :)
November 1, 2017 at 7:08 pm #871352it would be better if you get help from a mod here – give them an admin account.
Because you have first the trouble with parent name and child mismatch.
This was the first thing to do – because all other work will ground on a working child-theme.
Doing code to parent functions.php is to risky – and you will loose the things on next update.If this is done – i will help you furthermore. Because you have done allready alot of work on your theme it is best to have a backup of it.
___________
On your page ( by the way it is page-id-4652 )
you have those sticky column in : (#after_section_1)
You gave to the 1/3 column the custom class: fixed_element (on code it will be .fixed_element )
by the way you have to get rid of other solutions on that – the other codes will be causing problems on that)so the code will be :
add_action('wp_footer', 'include_sticky_values'); function include_sticky_values(){ ?> <script type="text/javascript"> (function($) { $(window).on('load resize', function(){ if ($(window).width() > 768) { /*** here comes the code to sticky element***/ $('.fixed_element').sticky('#after_section_1', { useTransition: false, animate: false, offset: 85 }); /*** here ended the code to sticky element***/ } }); })(jQuery); </script> <?php }
we have to play later with the offset value if it will be ok for your site
November 1, 2017 at 8:27 pm #871368hello,
concerning the themes :
==================
I do use a child-theme, and work in the child-theme functions.php (with backup also).
I just kept its firts given name which is “evryware”, I also didn’t change the name of the parent-theme which is still “enfold”.
I follow the steps you gave me for the style.css file, having finally this lines :
__________________________________
/*
Theme Name: evryware
Description: Childtheme fuer enfold
Version: 1.0
Template: enfold
*/
__________________________________Concerning your last post :
====================
The code you gave me has to be added in functions.php at the end of file ?
It allows to manage when the window width is below 768px ?
” if ($(window).width() > 768) { ”Regards,
cydut
November 2, 2017 at 3:32 am #871486Hi,
It is working now. You forgot to add the “fixed_element” custom class attribute to the column. Please remove browser cache or hard refresh before checking page.
Best regards,
IsmaelNovember 2, 2017 at 10:14 am #871586first of all : these are two different tryings to help you – the one from ismael – one with the including of a given jquery file by me.
You now have to decide.One advantage of the code recommended from me is: it is no fixing position ! Fixed Positioning allways till now goes to troubles on tablet-pcs or ipad/iphones.
my solution goes a different way: it calculates the top positioning concerning to scroll event. If you scroll down the top positioning increases ! and vice-versa.
So the “fixed” element isn’t really one – but it mimics the fixed position.
It works with the positioning relative ! This is something all browser can handle!By the way: this is no contest – it just reminds you to be carefull with fixed positioning.
see the difference and decide by yourself: https://webers-testseite.de/sticky-column/
1) make the screen of your browser window small as on mobile case ( responsive under 768px) and see what happens to the “fixed” elements.2) What if your icon-list has more entries? How do visitors of your site see the rest of your list ( under “Lieu” – if there are some)
November 2, 2017 at 12:28 pm #871620A little info about sticky : there is a discussion on css3 experimental position:sticky (-webkit-sticky) and it seems that this will be included in the future browsers. ( it is something in between fixed and relative positioning – as in my solution above) and it should only be necessary to set this css rule and the top bzw bottom value )
see here : https://developer.mozilla.org/en-US/docs/Web/CSS/position#Sticky_positioningNovember 2, 2017 at 11:22 pm #871876Hello all,
first of all, thank you again :)
Ismael : yes the left module is sticked but the right on is going over the left one when you scroll. so it’s not really fonctionnal (perhaps you have a solution ?)
The solution you can see on Guenni site ( https://webers-testseite.de/sticky-column/) is really what I needSo if Guenni is ok to give a step by step procedure I’m going to try his solution. I’m sure it could help others.
Let’s try it
Best regards,
Cydut
PS : i don’t forget another useful helper : Mike
November 3, 2017 at 12:06 am #871884Actually everything is already said !
A) erase the codes and custom-classes set by the other method
1) download the script from here: Download
2) Upload that script to your child-theme / js – Folder
3) Embed that javascript file to enfold – put in functions.php of your Child-Theme:function include_sticky_js_file() { wp_enqueue_script( 'stickyelement', get_stylesheet_directory_uri().'/js/jquery.stickyelement.min.js', array('jquery', 'avia-default'), 2, true ); } add_action( 'wp_enqueue_scripts', 'include_sticky_js_file', 100 );
4) Give the custom-Class to your element you want to fix : sticky_element
5). This comes to your functions.php of your Child-Theme:add_action('wp_footer', 'include_sticky_values'); function include_sticky_values(){ ?> <script type="text/javascript"> (function($) { $(window).on('load resize', function () { if ($(window).width() > 768) { /*** here comes the code to sticky element***/ $('.sticky_element').sticky('.entry-content-wrapper', { useTransition: false, animate: false, offset: 85 }); /*** here ends the code to sticky element***/ } }).trigger('resize'); })(jQuery); </script> <?php }
( in nearly all cases the direct parent element will be : entry-content-wrapper )
6) if you have to adjust the offset because on different pages it might be other settings this part you can add inbetween the commented lines with other custom class of sticky element ( perhaps : sticky_element2, etc.)
$('.sticky_element2').sticky('.entry-content-wrapper', { useTransition: false, animate: false, offset: 50 });
7) add this to your quick css to have not the calculated top distance on responsive case
you might adjust this – depending on your settings:
( sticky-scroll is the class added by that script to your sticky elements)@media only screen and (max-width: 767px){ .sticky-scroll {top: 0!important} }
8) Think of – that there is no other element in the same color-section under the sticky element – you have to open a new color-section if there are other content under it !
November 3, 2017 at 8:36 pm #872283Hello,
It works !!! Clap clap clap !
Thanks for your efforts with me.
Best regards,
Cydut
November 4, 2017 at 6:59 am #872412yes – nice !
if you can use this class for the not scrolling element ( sticky_element ) now again and again till you have to correct the offset because of different header size. As a class you can use it even on the same page multiple times.On this page with “Assistanat – Communication …” you don’t have to put in the contact form in the same 2/3 row. You can do it as before – but you have to do it in another color-section im you want it in a 1/1 Container.
one thing – your timeline is a bit shifted from the position – don’t know if you have done it by changing icon width
if you like to have it again on the middle of the icons:.avia-icon-list .iconlist-timeline { left: 19px; }
By – and
De rien- This reply was modified 7 years ago by Guenni007.
November 4, 2017 at 9:35 pm #872607November 6, 2017 at 11:21 pm #873419Hello,
ok for the color section 1/1 to finish the page with the contact form
I didn’t change anything for the icon-list. Where do I have to put the 19px to have back centered icons ?
Regards,
cydut
-
AuthorPosts
- You must be logged in to reply to this topic.