Hi,
thanks for your question, and sorry for the trouble.
Yes, this should be possible. You’d have to merge this code into the other code from the link.
Unfortunately, as this is more of a pure JavaScript question, it’s beyond what I can help with at the moment, due to time constraints. Sorry 🙁
Regards,
Tobias
Ahh, no problem. I understand.
Can I follow up with you next week? Or is this something you wont be able to help me with period?
Thanks Tobias!
Hi,
it would be great if you could try yourself first. You’ll basically just have to understand the logic behind the code, and how jQuery and its events work.
Then, it should be rather straightforward to apply the commands from your code to the code from the existing post.
Regards,
Tobias
Thank you so much for the quick reply, Tobias!
Unfortunately, I have very minimal understanding of Javascript (or anything outside of HTML and CSS for that matter). That code is not mine, I Googled it :/
If you can’t help me, I’ll try posting this question on another forum. Either way, I really appreciate your help.
Can you recommend anywhere that I might be able to get assistance with this?
Hi,
after taking another look, it’s actually simpler than I thought:
<script type="text/javascript">
jQuery(document).ready(function($){
$('.smooth-scroll').click(function(event){
event.preventDefault();
$('html,body').animate({scrollTop:$(this.hash).offset().top}, 500);
} );
$('.tablepress-id-1').on( 'click', 'tr', function() {
$(this).find('.smooth-scroll').last().click();
} );
} );
</script>
With this, a click on a row in table 1 (you’d have to adjust that table ID in the code, if necessary), would implicitly trigger a click on the last .smooth-scroll link in that row.
Regards,
Tobias
Thank you Tobias!!
You are awesome. Really, really appreciate it!
It’s working great except once it’s triggered, I can no longer scroll up or down the page. It just locks me to the anchor point.
Is that an issue on my end, or the code?
Here’s a quick recording of the issue: http://imgur.com/A4kvgkb
-
This reply was modified 8 years, 10 months ago by
lewisp91.
-
This reply was modified 8 years, 10 months ago by
lewisp91.
Hi,
that sounds strange. I can’t see any particular reason for that in the code.
Does this also happen when you directly click the link (and not the row).
I can only assume that this is caused by the smooth-scroll JavaScript code itself.
Regards,
Tobias
Hi Tobias,
Yes, it also happens when I click the link itself. I’ve reverted to the previous for now, but if you have any ideas, please let me know 🙂
Hi,
ok, but does it happen with just your initial code as well?
Regards,
Tobias