Cannot get jQuery scrollTo plugin to work OnClientClick -


i need getting ariel flesler`s jquery scrollto plugin work. can work fine if following (note: web forms site jquery included on master page):

<head> <script type="text/javascript" src="scripts/jquery.scrollto.min.js"></script> <script type="text/javascript">     jquery(function ($) {         var $panetarget = $('#pane-target');           $('#ctl00_detailsboxholder_linkbutton5').click(function () {             var $target = $panetarget.find('#div14');             $panetarget.stop().scrollto($target, 800);         });     }); </script></head> ... ... <ul> <li> <asp:linkbutton id="linkbutton5" runat="server"> jquery object</asp:linkbutton></li> </ul>  <div id="pane-target">..bunch of elements... <ul>..bunch more elements... <li><div id="div14">etcetc</div></li> ..bunch more elements...</li> </ul> </div> 

ok, works -- great! however, don`t want bind right away button click event because in practice have repeater , need click on repeater element fire the scrollto function. removed click binding in script block , added onclientclick link button. figured following work fine:

<head> <script type="text/javascript" src="scripts/jquery.scrollto.min.js"></script> <script type="text/javascript">     function dosomescrolling() {        var $panetarget = $('#pane-target');        var $target = $panetarget.find('#div14');        $panetarget.stop().scrollto($target, 800);     } </script></head> ... ... <ul> <li> <asp:linkbutton id="linkbutton5" runat="server" onclientclick="dosomescrolling();"> jquery object</asp:linkbutton></li> </ul>  <div id="pane-target">..bunch of elements... <ul>..bunch more elements... <li><div id="div14">etcetc</div></li> ..bunch more elements...</li> </ul> </div> 

nope! following error:

$panetarget.stop(...).scrollto not function 

what gives??

i love hear better solution (i couldn't find documentation on this) looks jquery plugin isn`t loaded @ time onclientclick fires. alleviate moved entire plugin code onclientclick function, resolved issue


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -