bytesize Posted April 10, 2013 Share Posted April 10, 2013 <script type="text/javascript"> function toggleInteractContainers(x) { if ($('#'+x).is(":hidden")) { $('#'+x).slideDown(200); } else { $('#'+x).hide(); } $('.interactContainers').hide(); } </script> <?php $interactionBox = '<div class="interactionLinksDiv"> <a href="#" onclick="return false" onmousedown="javascript:toggleInteractContainers(\''.$show['wb_memberid'].'\');">Send Request</a> </div>'; echo $interactionBox; ?> <div class="interactContainers" id="<?php echo $show['wb_memberid']; ?>"> <a href="users/add?add=<?php echo $show['code']; ?>">Yes</a> <a href="#" onclick="return false" onmousedown="javascript:toggleInteractContainers('<?php echo $show['wb_memberid']; ?>');" title="Close">No</a> </div> When scrolled down to the "Yes" link and it is clicked, the page jumps up to the top of the browser. If "No" is clicked, the page does not move, which is the effect I'm looking for. How can I stop the page from jumping to the top? I have tried using "#", onclick, and onmousedown within the "Yes" href to no avail. Anyone? Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 10, 2013 Share Posted April 10, 2013 Your yes link actually sends you to a new page. The no one stays on the same page and goes nowhere. That is exactly how you have coded it. If you want the yes link to go to a new page AND scroll down to an anchor, that page needs to have the anchor on it, then you need to add it in the end of the link. Quote Link to comment Share on other sites More sharing options...
bytesize Posted April 10, 2013 Author Share Posted April 10, 2013 Yes, the page is being redirected in the controller. Thanks for your help. I will continue working on this until I figure it out. Quote Link to comment Share on other sites More sharing options...
Solution bytesize Posted April 10, 2013 Author Solution Share Posted April 10, 2013 Jessica, thank you for your help, you pointed me in the right direction. It took a little bit of work on the php side, but I got it to work! Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 10, 2013 Share Posted April 10, 2013 Good job! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.