-
AuthorPosts
-
May 21, 2018 at 5:11 pm #959870
Hi
I am looking to reveal a color section, when clicking on a button or link and I can do this with code taken from https://kriesi.at/support/topic/hidding-color-section/#post-432734.
However, Im looking for same effect as an anchor link were the section scrolls to the top of the page, in addition to being revealed?
Can this be done?
Kind regards
Duncan
May 23, 2018 at 2:47 pm #960826Hey dweddell,
Try using this code:
function add_custom_cs(){ ?> <script> jQuery(window).load(function(){ jQuery("#your-unique-color-section-id").hide(); jQuery( ".your-custom-button-class" ).click(function() { jQuery( "#your-unique-color-section-id" ).toggle(); window.scrollTo(0,0); }); }); </script> <?php } add_action('wp_footer', 'add_custom_cs');
If you need further assistance please let us know.
Best regards,
VictoriaMay 23, 2018 at 3:39 pm #960866Thanks Victoria
I tried this, but section still wont scroll to the top?
cheers
Duncan
May 25, 2018 at 3:51 pm #962222Hi,
Do you want it to scroll to the section when it is revealed? That is what happens when I clicked on the “answer” button.
Best regards,
IsmaelMay 29, 2018 at 5:48 pm #963821Hi Ismael
I am looking for the section to scroll to the top of the page, in a similar manner to the link below.
Strangely, it works when I press the button on the third attempt, but not on the first
kind ergards
Duncan
June 1, 2018 at 7:26 am #965075Hi Duncan,
I’m not sure if I’m missing something here, but the Click here link on the page you posted opens the section, then scrolls down to the divider on my end. Is that the correct behaviour?
Best regards,
RikardJune 7, 2018 at 3:42 pm #969674Hi Rikard
I’ve made a screencast so you can view what I’m seeing.
The first site (which im working on using Enfold) is not scrolling to the top. Whereas an existing site, which I’m basing the new site on scrolls nicely to the top.
Can I do this with the site Im working on?
Kind regards
Duncan
June 10, 2018 at 11:12 am #970725Hi Duncan,
Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?
Is the custom code still there?
Best regards,
VictoriaJune 11, 2018 at 10:28 am #971058This reply has been marked as private.June 11, 2018 at 3:04 pm #971221Hi Duncan,
You will need to have a bit more complex JavaScript function here.
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 it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.