Before you ask please READ THIS

Trigger hidden side bar widget with a button elsewhere on the page

Hi, In my hidden side bar I have a social sharing widget to save the page that the user will be on and share it on social media. What I would like to do is add a button on each blog post and portfolio page that says "Share this post/page" or whatever, then on clicking it, the hidden sidebar appears. From my understanding this link is generated with javascript so I understand its not a simple hyperlink, but it would be great if you can tell me the script used to open it so I can either create a custom button with html and js, or somehow add the trigger to the theme styled button.

Thanks

Comments

  • AirAir
    Posts: 10,970
    Hello:-)
    If you know JS you can write simple trigger that will do .click() on button that open hidden sidebar. Just add ID to you button and target it by this ID.

    Do you have any JS/jQuery knowledge?

    With kind regards.
  • i'm afraid I have no knowledge of JS. I am ok with most CSS and html, but struggle with php and JS!

    Please let me know If you know a script that will work, then I can add it.

    Thanks again
  • AirAir
    Posts: 10,970
    You can add such link:
    <a href="javascript:(function(){ jQuery('#side-menu-switch').click(); })()">Your link</a>
    It will open hidden sidebar:-)

    With kind regards.
  • Wow this works perfectly thanks! I can add this to a custom button too which is so useful!

    Here's how it looks if you are interested: https://cl.ly/0z3U01090Q0m/Screen Recording 2017-02-20 at 01.45 pm.gif
  • AirAir
    Posts: 10,970
    Looks very nice, bravo!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!