knockout.js - Scroll to a Div in KnockoutJS -


i trying create similar jquery scroll functionality scroll div when pressed button didn't find solution in knockoutjs. please suggest approach?

$('html,body').animate({ scrolltop: $('#mydivwheretobescrolled').offset().top }, 1000); 

you need call function in model , there need add code,

 <button data-bind="click: yourfunction">scroll</button> 

and in model

this.yourfunction = function(){                $('html,body').animate({ scrolltop: $('#mydivwheretobescrolled').offset().top }, 1000);            } 

let me know need.

i have created plunkr, please have http://plnkr.co/edit/j0dglzjt8sr2pj0u83fs?p=preview


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -