CalcBuilder Forum

scroll down

User moon_584 2012-08-05 18:04:14

Is there a way to make the page scroll down after pressing calculate?

Moonsoft support 2012-08-06 09:52:57

Hello,

You can try to paste this code into "Javascript Events" section in your calculator:

//DO NOT MODIFY THIS LINE, IS NEEDED TO HANDLE PROPER CALCULATOR INSTANCE
seed=$('cb_layout_wrapper').getParent().getProperty('id').substr(0,$('cb_layout_wrapper').getParent().getProperty('id').indexOf("_"));

// Event on Calculate Button
$(seed+'_calculate').addEvent('click',function(){
// Go to the end of the page
window.scrollTo(0, document.body.scrollHeight);
});

This get the calculate event and scroll down the page.

Regards,

User moon_584 2012-08-12 07:22:02

didn't work, any other suggestions?

Moonsoft support 2012-08-12 12:01:48

Hello,
this is the only way we can think of, we have tested it and it places the scroll at the beginning of the result section (which is the bottom of the page at the time you press calculate). Please check you have copied the script as stated before, and look for any javascript error at your page which may be causing the script to fail.

Hope this helps, regards

User moon_584 2012-08-13 03:58:51

Is there a way to scroll it to the end of the result section? I think that would probably do the trick. My result section is pretty long.

Moonsoft support 2012-08-13 10:58:18

Hello,
you can't link to the end of a section that is not present on the page, because when you click calculate button, the result has not returned yet. In addition, when showing the results, a reveal effect is played, so it takes a while until is enterely shown. Until that moment, going to the end of the page will lead you to the beginning of the result section.
So, in order to get what you need, you would need to do some more complex coding, changing the core code of the extension. In case you want to give it a try, you should modify the file

modules/mod_calcbuilder/tmpl/user.php

changing the function submitAjaxForm to avoid playing effects, and executing the scroll to the end once the result is shown.

If you want us to do a custom version with this change, please place a ticket at helpdesk or send us an email and we'll give you a quote.

Regards

User moon_584 2012-08-13 20:49:48

OK I'll send you an email. Thanks

...
Support/development 10 hours

Get a bigger amount of hours for more complex tasks and get a 10% discount

Buy now!
...
Support/development 40 hours

With the peace of mind of having a professional team at your service (20% discount)

Buy now!