I have a block of HTML and image running in Shopify I’d like to display and hide on click of the image. I am new to jQuery, can you help please?
<div class="team__member grid__column grid__column--one-half-medium grid__column--one-quarter-large">
<h3>CEO&WRITER</h3>
<p class="font-size--smaller">The CEO maintains an active involvement in all aspects of the company, despite not having slept since 2016.</p>
{% include 'image--asset', width: 1000, height: 836, src: 'TEAM_CEO__CLEANUP_BC.png'%}
</div>
this is the block I’d like to display and hide on click of the image,
<div style="display: block;width: 100%!important;height: 200px;padding: 5px;background-color:yellow;background-image:linear-gradient(#c2aa00,#de490f); "> </div>
3
Answers
First you must set an id to the element you want to hide or show, after doing so you can use jquery’s
show()
andhide()
method.Example:
From w3schools: https://www.w3schools.com/howto/howto_js_toggle_hide_show.asp
html:
Javascript: