I’m trying to trigger an element to slide up when I reach an anchor. The anchor ID is #blacksection and the element class is .vc_tta-panels-container. I read on another thread that you can trigger onclick actions using something like:

jQuery("#blacksection").trigger('click');

And then I’m using;

  jQuery("#blacksection").on('click', function() {
    jQuery(".vc_tta-panels-container").slideUp();

as the remaining JS. So I have this:

<script>
jQuery("#blacksection").trigger('click');
  jQuery("#blacksection").on('click', function() {
    jQuery(".vc_tta-panels-container").slideUp();
});
</script>

Which isn’t working, only just started learning JS and it’s baffling my mind, can anyone shed some light on triggering .slideUp for a class at an anchor?

Read more here: Trigger .slideUp at anchor


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: