i have button @ top of page:(button-a)
<div class="menu-btn-right loginandadd" > <a href="#" id="a" class="some_class" title="something"</a> </div>
then have button half way through page (button-a not visible anymore):(button-b)
<a id="b"><img class="start1addproductbutton" src="#" alt="empty" width="1" height="1" /> </a>
also, have following script:
<script>// <![cdata[ jquery("#b").click(function(){ jquery("#a").trigger('click'); return false; }); // ]]></script>
in current setting, when button-b clicked, button-a clicked automatically.however since button-b located in middle , button-a not visible, when button-b clicked, users not know button-a clicked unless manually scroll top.
i tried add anchor when button-b clicked, page scrolled top , users can see button-a automatically clicked.
however in test due javascript, anchor tag not working. can when button-b clicked, page scrolled top , button-a still automatically clicked?
thanks
try code scrolls element manually, instead of triggering click event of element.
<script> jquery("#b").click(function(){ jquery('html, body').animate({ scrolltop: jquery("#a").offset().top }, 2000); return false; }); </script>