-
AuthorPosts
-
August 25, 2017 at 11:00 am #843852
Hello!
I followed this instructions given here; https://kriesi.at/support/topic/hidding-color-section/
( PS: I used the last code you guys put in there, haven’t tested the first one )
I’ve managed to hide the color section but the button click will not toggle the visibility..
Could you see if I have done anything wrong?
I don’t know how what the button should have as button link, so I put the section ID there..- This topic was modified 7 years, 3 months ago by cimpleadmin. Reason: More information
August 28, 2017 at 5:51 pm #844919Hey cimpleadmin,
Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?
Best regards,
VictoriaAugust 29, 2017 at 8:22 am #845225Yes!
- This reply was modified 7 years, 3 months ago by cimpleadmin.
August 29, 2017 at 11:21 am #845278you can insert it as manual and only a #
i tried it – see here https://webers-testseite.de/colorsection-toggle/
and it works with thatAugust 29, 2017 at 11:31 am #845282Hi Guenni007, I can’t seem to understand how you’ve set this up, could you please explain a bit more of how you’ve set this up?
Thanks for any inputs!August 29, 2017 at 11:41 am #845287i placed a container above the color-section ( all you want ) on my case it is a 2/3rd 1/3rd Column.
In the 1/3rd Column on the right i placed a button with manual link to #
and as described in the thread you mentioned with the custom class .i edited a bit the code because i like to know what is all about – so my code looks like :
function add_custom_toggler(){ ?> <script> jQuery(window).load(function(){ jQuery("#toggle-color-section").hide(); jQuery( ".color-section-toggler" ).click(function() { jQuery( "#toggle-color-section" ).toggle(); }); }); </script> <?php } add_action('wp_footer', 'add_custom_toggler');
the button gets the custom class: color-section-toggler
the color section gets the unique id: toggle-color-sectionAugust 29, 2017 at 11:57 am #845289I’ve now changed the code in functions.php to exactly what you have, and I’ve set up a new page with something like you describe at:
- This reply was modified 7 years, 3 months ago by cimpleadmin.
August 29, 2017 at 12:04 pm #845290you inserted in the field the class with the dot – the dot comes automatically to the class
insert please only : color-section-toggler and not : .color-section-toggleryou did it right with the ID – you don’t insert it with the # – the same with the class
August 29, 2017 at 12:07 pm #845292Thank you kind sir!
It now works perfectly :)August 29, 2017 at 12:14 pm #845295Ikke noe problem
August 29, 2017 at 12:54 pm #845305I tried to add this to the middle my front-page now (The button with the text “Les mer”), but it seems here that the button just sends me to the top of the page without opening the section at all;
- This reply was modified 7 years, 3 months ago by cimpleadmin.
August 29, 2017 at 1:52 pm #845320it would be better to insert as button link the page url with the id
so in your case to that site try to insert #toggle-color-section- This reply was modified 7 years, 3 months ago by Guenni007.
August 29, 2017 at 1:59 pm #845322Hmm.. I tried both of them and it looks like they’re doing the same thing. When button is clicked the page just scrolls upwards a bit, and nothing really happens, sadly the section is not toggled.
August 29, 2017 at 2:00 pm #845324i changed it above try only #toggle-color-section as target of your button
August 29, 2017 at 2:06 pm #845326It does exactly the same it looks like.. Thanks you for all the suggestions though!
August 29, 2017 at 2:10 pm #845329does the other page with the toggler exists too?
try to delete this page or remove the ID from that color section to prove if it is a double ID conflict.August 29, 2017 at 2:18 pm #845333it seem to be a matter of full-width button but i can not see why – the thing is reproducable on my example site !
August 29, 2017 at 2:19 pm #845334Yes it did,
I removed the ID and deleted the page, but the issue remains the same.August 29, 2017 at 2:22 pm #845337Ah, glad to hear its not only on my site. Although I used a full-width button to test it on the example page (although here it was inside layout element 1/3) where I got it working, so does it has something to do with the button lying outside the layout elements?
- This reply was modified 7 years, 3 months ago by cimpleadmin.
August 29, 2017 at 3:45 pm #845365so i played a bit with the code:
as target for the buttons use: #toggle-color-section
and the class goes to buttons is: color-section-toggleruse this code instead (has the opportunity that the color-section is there but with height = 0px )
function add_custom_toggler(){ ?> <script> jQuery(window).load(function () { jQuery("#toggle-color-section").addClass("notseen"); jQuery(".avia-button-wrap.color-section-toggler").click(function () { jQuery("#toggle-color-section").toggleClass("notseen"); }); }); </script> <?php } add_action('wp_footer', 'add_custom_toggler');
and do this to quick css:
.notseen { height: 0 !important; min-height: 0 !important; }
see here: https://webers-testseite.de/colorsection-toggle/
allthough i believe that the hide function should work too- but i guess the link to the anchor has no target on click. Because the color-section is on display: none.
here the color-section is allways there (even for seo) but it is not visible- This reply was modified 7 years, 3 months ago by Guenni007.
August 30, 2017 at 9:40 am #845707That did the trick with the functionality!
I still had an issue where the content of the toggle-section was shown (at all times) in the next section, and when I clicked the button to toggle the section it looked like it was supposed to do.
I added
.notseen { height: 0 !important; min-height: 0 !important; text-indent: 100%; white-space: nowrap; overflow: hidden; }
to the .notseen class and that did it for me.
Thank you very much for your help sir!
August 30, 2017 at 9:45 am #845708and by the way you can replace the text inside your button on click:
In my case on the testpage it is “contact me” to replace
function add_custom_toggler(){ ?> <script> jQuery(window).load(function () { jQuery("#toggle-color-section").addClass("notseen"); jQuery(".avia-button-wrap.color-section-toggler").click(function () { jQuery("#toggle-color-section").toggleClass("notseen"); jQuery(".avia-button-wrap.color-section-toggler span.avia_iconbox_title").text(function(i, v){ return v === "contact me" ? "thanks for your interest" : "contact me" }) }); }); </script> <?php } add_action('wp_footer', 'add_custom_toggler');
etc. pp
August 30, 2017 at 9:50 am #845710Thanks!
August 30, 2017 at 5:02 pm #845866Hi cimpleadmin,
Glad you got thing working for you!
Great job, @Guenni007! Thank you :)
If you need further assistance please let us know.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.