ClientJS: DOM-Funktion scrollIntoView() als ClientJS->scroll_into_view implementiert
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 29 Apr 2015 09:37:02 +0000 (11:37 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 30 Apr 2015 07:36:48 +0000 (09:36 +0200)
SL/ClientJS.pm
js/client_js.js

index 2eedbee..d4775b8 100644 (file)
@@ -118,6 +118,8 @@ my %supported_methods = (
   reinit_widgets         => 0,  # kivi.reinit_widgets()
   run                    => -1, # kivi.run(<TARGET>, <ARGS>)
   run_once_for           => 3,  # kivi.run_once_for(<TARGET>, <ARGS>)
+
+  scroll_into_view       => 1,  # $(<TARGET>)[0].scrollIntoView()
 );
 
 sub AUTOLOAD {
index a0e6eab..6d89819 100644 (file)
@@ -131,6 +131,7 @@ ns.eval_json_result = function(data) {
       else if (action[0] == 'reinit_widgets')       kivi.reinit_widgets();
       else if (action[0] == 'run')                  kivi.run(action[1], action.slice(2, action.length));
       else if (action[0] == 'run_once_for')         kivi.run_once_for(action[1], action[2], action[3]);
+      else if (action[0] == 'scroll_into_view')     $(action[1])[0].scrollIntoView();
 
       else                                          console.log('Unknown action: ' + action[0]);