Posts

Showing posts from January, 2012

jquery - Is there a way to find javascript-library dependency trough your application -

in application have there javascript-libraries need updated. updates there parts of application break. it's aps.net application , library needs updated jquery-ui is there way find out functions used trougout application?

Rails 4 + AngularJS: App.js config and run functions don't work -

i'm working rails 4 , angularjs. i've got app working. controllers, directives, services, etc. however, main app.js file refuses fire config , run functions. i've got console.logs in there test how far gets. here's code: angular-app/app.js 'use strict'; console.log('we see app.js file'); // works var app = angular.module('bruno', []) console.log(app) //this works // stops working app.config(function ($httpprovider) { alert('config'); // can't see $httpprovider.defaults.headers.common['x-csrf-token'] = $('meta[name=csrf-token]').attr('content'); }) app.run(function () { console.log('app running'); // can't see }); like said, other controllers working fine. console doesn't show any errors , loads should. rails application.js file: //= require angular-app/app //= require_tree ./angular-app/templates //= require_tree ./angular-app/modules //= require_tree ./angula

Can I create an object that receives arbitrary method invocation in python? -

in python, can create class that, when instantiated, can receive arbitrary method invocation? have read this couldn't put pieces together i guess has attribute lookup . class foo : class foo(object): def bar(self, a): print the class attribute can obtained print foo.__dict__ , gives {'__dict__': <attribute '__dict__' of 'foo' objects>, '__weakref__': <attribute '__weakref__' of 'foo' objects>, '__module__': '__main__', 'bar': <function bar @ 0x7facd91dac80>, '__doc__': none} so code valid foo = foo() foo.bar("xxx") if call foo.somerandommethod() , attributeerror: 'foo' object has no attribute 'somerandommethod' resulted. i want foo object receive random invocations , defaults no-op, ie. def func(): pass how can achieve this? want behaviour mock object testing. from http://rosettacode.org/wiki/respond_to_an_unknown_

c++ - having issues using gl_VertexID to draw const vertices that are inside the shader -

hi there having problems gl_vertexid seems not updating or when use in opengl program draw vertices stored in shader vec4's,as far know should straightforward , job without problems or issues have done correctly unfortunately isnt showing here : my main program #include "shaders.h" int main(){ glfwinit(); glfwwindowhint(glfw_context_version_major, 4); glfwwindowhint(glfw_context_version_minor, 3); glfwwindowhint(glfw_opengl_profile, glfw_opengl_core_profile); glfwwindowhint(glfw_opengl_forward_compat, gl_true); glfwwindowhint(glfw_resizable, gl_false); glfwwindow* window = glfwcreatewindow(800, 600, "opengl", null, null); glfwmakecontextcurrent(window); glewexperimental = gl_true; glewinit(); //create vertex array object //vertex array object holds state gluint vao; glgenvertexarrays(1, &vao); glbindvertexarray(vao); //compile , link shaders here gluint program = compile_shaders(); gluseprogram(program); while(!glfwwindowshouldc

r - Store function definition as a character object -

take following example function temp_fn <- function(){ print("hello world") } i know typing function name without parenthesis return function definition, is: > temp_fn function(){ print("hello world") } however, can't figure out how store printed out character object. example > store_temp_fn <- as.character(temp_fn) error in as.character(temp_fn) : cannot coerce type 'closure' vector of type 'character' you can use capture.output() in combination function name this: temp_fn <- function(){ print("hello world") } temp_fn_string <- cat(paste(capture.output(temp_fn), collapse = "\n")) > temp_fn_string function(){ print("hello world") }>

fileinputstream - Java Resource Leak -

i have code snippet in application , quite sure have closed streams. but, surprisingly, keep getting: resource acquired @ attached stack trace never released. see java.io.closeable information on avoiding resource leaks. java.lang.throwable: explicit termination method 'close' not called any pointers useful. if (fd != null) { inputstream filestream = new fileinputstream(fd.getfiledescriptor()); bytearrayoutputstream bos = new bytearrayoutputstream(); byte[] buf = new byte[1024]; try { (int readnum; (readnum = filestream.read(buf)) != -1;) { bos.write(buf, 0, readnum); } content = bos.tobytearray(); } catch (ioexception ex) { ex.printstacktrace(); } { try { if (filestream != null) { filestream.close(); } if (bos != null) { bos.close(); } } catch (ioexception e) { e.printstacktrace(); }

javascript - How to add "slow effect" to my slide menu when slide out from left? -

$(document).ready(function() { $('.slideout-menu-toggle').on('click', function(event) { event.preventdefault(); // create menu variables var slideoutmenu = $('.slideout-menu'); var slideoutmenuwidth = $('.slideout-menu').width(); // toggle open class slideoutmenu.toggleclass("open"); // slide menu if (slideoutmenu.hasclass("open")) { slideoutmenu.animate({ left: "0px" }); } else { slideoutmenu.animate({ left: -slideoutmenuwidth }, 250); } }); }); $(document).ready(function() { $('.slideout-menu li').click(function() { $(this).children('.mobile-sub-menu').toggle("slow"); }); }); .slideout-menu { position: absolute; top: 100px; left: 0px; width: 100%; height: 100%;

What changed in Ruby? -

the following spec passes fine in ruby 2.1.5 fails in 2.2.0 , can't tell that's about: # job.rb class job < activerecord::base validates :link, :url => true end # job_spec.rb require 'rails_helper' describe job describe "#create" ["blah", "http://", " "].each |bad_link| { should_not allow_value(bad_link).for(:link) } end end end fail log looks this: 1) job#create should not allow link set "http://" failure/error: should_not allow_value(bad_link).for(:link) expected errors when link set "http://", got no errors # ./spec/models/job_spec.rb:14:in `block (4 levels) in <top (required)>' i find way spec pass ruby 2.2.0 include validates_url gem in project!! does know about? maybe solution isn't ideal, works. replace validates_url gem validates gem . has urlvalidator (written me), tested. gem 'validates&

bash - Replace a variable with text (sed) -

i have find specific text in file , replace text new text. the contents of file are: host=100 servers=4 clients=70 i have tried this: var=$(grep "servers=" /path/to/file) sed -i "s/${var}/servers=5/g" /path/to/file but gives me error: sed: -e expression #1, char 2: unterminated `s' command note: want update value of each of variable i.e. servers=4 should replaced servers=5. please me figure out solution. thanks. the output of grep ends newline character. sed expects whole command on 1 line or escaping line breaks. however, can achieve complete task sed only: sed -i 's/^servers=[0-9]*$/servers=5/' /path/to/file

javascript - CSS: How to scale an <img> to cover entire parent <div>? -

question: http://jsfiddle.net/log82brl/15/ the <img> isn't shrink wrapping expect min-width:100% i'm trying shrink <img> until either height or width matches container click anywhere in <iframe> toggle container shapes please try edit <img> css: 1) maintain aspect ratio 2) cover entire surface area of container div 3) only edit image this centering approach looks kinda sketch it's pretty robust my question specifically: scale <img> fill (maintain aspect ratio cover entire surface) of parent <div> parent <div> resizes maybe somehow use css flex box-layout or something? maybe transform? answer : http://jsfiddle.net/log82brl/17/ set html source transparent base64 pixel (credit css tricks ) <img id="img" src="data:image/gif;base64,r0lgodlhaqabaiaaaaaaap///yh5baeaaaaalaaaaaabaaeaaaibraa7" /> use css background property #img { width: 100%;

jquery - How to hide flash message after few seconds? -

in application user can post challenge other user. after successful posting challenge displaying 1 flash message same. want hide message after few seconds. wrote following code : $(document).ready(function(){ settimeout(function() { $("#successmessage").hide('blind', {}, 500) }, 5000); }); <div id="successmessage" style="text-align:center; width:100%"> <font color="green" > <%if flash[:alert]=="your challenge posted successfully."%> <h4><%= flash[:alert] if flash[:alert].present? %> <%end%> </font> </div> but code not hiding div "successmessage". you can try : settimeout(function() { $('#successmessage').

mysql - Why does changing the comparison in a HAVING clause from '=' to '<' change the output when there are no matches? -

in following query, changing comparison operator in having clause '=' '<' when query returns no results changes output there's either 1 row returned (of nulls) or no rows returned. can explain why behaviour demonstrated? i'd ideally have first query return 0 rows, nice if done without wrapping in query exclude nulls. query: select `templates`.* `templates` inner join `items` on `items`.`template_id` = `templates`.`id` having count(items.id) = 0 results: null,null,null... (1 row(s) returned) in comparison to: query: select `templates`.* `templates` inner join `items` on `items`.`template_id` = `templates`.`id` having count(items.id) < 0 results: (0 row(s) returned) but also, variation having count(items.id) < 1 returns row of nulls: query: select `templates`.* `templates` inner join `items` on `items`.`template_id` = `templates`.`id` having count(items.id) < 1 results: null,null,null... (1 row(s) returned)

python - Genetic Algorithm roulette selection - returning 2 parent chromosomes -

i want implement roulette wheel selection in ga algorithm. tried following guide https://stackoverflow.com/a/5315710/536474 sends new population instead of 2 best parents. suppose found fitness score initial population , need select 2 parent chromosomes population according fitness. , further goes crossover , mutation processes. in following case, how can find 2 best parents crossover based on roulette wheel selection? population = [[text1],[text2],[text3],.....[textnum]] fitnesses = [0.8057515980834005, 1.2151126619653638, 0.6429369518995411, ... 0.805412427797966] num = 50 it doesn't send new population, num parents. if want 2 parents call roulette_select way: roulette_select(population, fitnesses, 2) often ga crossover operator expects 2 parents there variations many parents (e.g. genetic algorithms multi-parent recombination - a.e. eiben, p-e. raué, zs. ruttkay ). there self-crossover operators. so having num input parameters makes sense.

c# - How do I decide the `DigestValue`, `SignatureValue` and `RSAKeyValue` for digital signing of XML -

i working on project need verify xml digitally signed or not. getting hard me try , validate xml key values following <signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <signedinfo> <canonicalizationmethod algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> <signaturemethod algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> <reference uri=**some uri value**> <transforms> <transform algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> <transform algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> </transform> </transforms> <digestmethod algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> <digestvalue>**some digest value**</digestvalue> </reference> </signedinfo> <signaturevalue>**some signat

jquery - How to changing css on bootstrap button Group -

the below code toggles button in group. i'm having fun tying change css of these buttons, in particular selected button. <span class="label label-primary">age</span> <div class="btn-group" id="ageid"> <button type="button" style="width:120px" class="btnmyage btn-default" id="3">under 10</button> <button type="button" style="width:120px" class="btnmyage btn-default" id="1">under 50</button> <button type="button" style="width:120px" class="btnmyage btn-default" id="2">over 50</button> </div> <script> $(".btn-group > .btnmyage").click(function () { $(this).addclass("active").siblings().removeclass("active"); }) </script> my custom css file: .btnmyage, .btn:acti

node.js - Default this video to HD when embedded -

trying set true via vimeo api (i happen using offical npm module). going through api playground see many embed.### options, don't see "default video hd when embedded" listed. it not seem available set part of embed preset -- can when editing embed options of specific video, under " miscellaneous ". would set true via api call, experience this? update vimeo responded question on forums: https://vimeo.com/forums/api/topic:268251 tldr; enable " always play videos in hd " from: vimeo.com/settings/videos , default embedded vids hd "when possible" @stdob-- points out link , claiming can access via api, have not proven it.

html - Send multiple checkbox values through $_POST via mail PHP -

This summary is not available. Please click here to view the post.

javascript - Submit an input box OR a select box (not both) -

i want have option users submit form have option either use either select box or input text box, not both. here form code: <!-- text input--> <div id="incident-type" class="control-group"> <label class="control-label" for="textinput">incident type (use box or common incident box)</label> <div class="controls"> <input id="textinput" name="incident_type" type="text" class=" form-control"> </div> </div> <!-- select box --> <div id="incident-control-box" class="control-group"> <label class="control-label" for="textinput">common incidents (use box or incident type box)</label> <div class="controls"> <select onclick="hideinputbox()" id="textinput incident-type1" name="inci

polymer - How to use the "hidden" attribute? -

Image
i can see official polymer elements using hidden attribute so: hidden$="[[!somevalue]]" , hidden$=[[somevalue]] however, in case, somevalue huge object , while above expressions still work, hidden$=[[somevalue]] can see this: app unnecessary work serializing object + having text makes harder me work devtools. so, used hidden=[[somevalue]] , hidden=[[!somevalue]] instead. these work charm. my questions are: can safely use hidden= instead of hidden$= ? why works? understood $= sets attributes , = sets properties. if should use hidden$= whats best way hidden$=[[bigobject]] ? it looks can safely use hidden attribute or property. this polyfill webcomponentsjs library says setting property reflect attribute. explain why $= , = have same behavior. since setter overrides value '' , expect setting property ( = ) use less memory , more performant, benchmarks real way know sure.

c - What is an intuitive way to interpret the bitwise operators and masking? Also, what is masking used for? -

i'm learning bitwise operators , masking right in computer systems class. i'm having trouble internalizing them. i understand operators, &, |, ^, >> (both arithmetic , logical shift), , << do, don't quite they're used aside optimizing multiplication , division operations (for >> , <<), , check if bits on or off (the & operator). also, don't understand masking used for. know doing x & 0xff used extract least significant bit in integer x, can't extrapolate how other kinds of masks (e.g. extract leftmost 1 in number, obtain number of 1s in number, etc.) used? could please shed light on this, preferably examples? thank you. a way understand bitmasks example give one. lets have array of structs: struct my_struct { int foo; int bar; }; struct my_struct array_of_structs[64]; // picked 64 specific reason discuss later we use array pool , elements of array allocated needed , can deallocated. 1 way accompli

php - Execute query update with form from a query -

i trying create button on user list page delete row, or make user admin. here info user query , html: <?php $query = "select * users"; try { $stmt = $db->prepare($query); $result = $stmt->execute(); } catch(pdoexception $ex) { die("an error has occured. please contact server administrator assistance."); } $rows = $stmt->fetchall(); ?> <?php foreach($rows $row) : ?> <?php if($row['usertype'] == 2) { $usertype = "<span style='color:#f7fe2e;'>donator</span>"; } elseif($row['usertype'] == 3) { $usertype = "<span style='color:red;'>admin</span>"; } elseif($row['usertype'] == 4) { $usertype = "<span style='color:orange;'>owner</span>"; } else { $usertype = "<span style='color:#585858;

How to display row value as column value in SQL Server (only one column rows value should be displayed as multiple columns) -

using join of parent , child tables getting results this select a.id, a.pname, b.childname parentinfo right join childinfo b on a.id = b.pid output: id pname childname -------------------------- 1 parent1 p1child1 1 parent1 p1child2 1 parent1 p1child3 2 parent2 p2child1 2 parent2 p2child2 3 parent2 p3child1 3 parent3 p3child2 3 parent3 p3child3 3 parent3 p3child4 4 parent4 p4child1 4 parent4 p4child2 4 parent4 p4child3 but children should displayed columns, , 1 parent should displayed once. and there can numbers of children. i want display results this: id pname child1 child2 child3 child4 ------------------------------------------------------ 1 parent1 p1child1 p1child2 p1child3 2 parent2 p2child1 p2child2 3 parent3 p3child1 p3child2 p3child3 p3child4 4 parent4

javascript - React/Flux implementation technique is unclear for when a parent component needs to pull strings on child component -

i have situation isn't contrived, , i'm having trouble implementing using react best practices. in particular produces error: uncaught error: invariant violation: setprops(...): called setprops on component parent. anti-pattern since props reactively updated when rendered. instead, change owner's render method pass correct value props component created. the situation this. parent contains child component. parent has event handlers ui , behavior work, inside child component needs render html css change height style. therein lies wrinkle, information flows upward or stays put, here need change in child. parent component ( widget ) renders this: <div class="widget"> <div class="widgetgrabbar" onmousedown={this.handlemousedown}> <widgetdetails heightprop={this.props.detailsheight} /> </div> and elsewhere in widget i've got componentdidmount: function() { document.addeventlistener('mousemove', t

dronekit python - How to send waypoints programmatically to drone? -

i new @ , trying understanding of this. have read lot on dronekit-python site trying figure out how able communicate it. drone using iris+ i have looked more , there software provide this, want able control plus more. i want set waypoints, tell fly give way points , keep going them. also, able arm itself, in example, , override safety mechanism. here basic of trying use for. have fly @ time. go waypoints 1,2,3,1,etc.. after x amount of time or on low battery go launch point , land. i have found plenty of code provides need do, though don't know if work , more importantly don't know how start programming this. maybe have wrong approach in doing this? i kind of want light api, in future can make simple ui on phone , insert coordinates give ways points , it. know there software out there it, want remove need touching drone. want start , end autonomously. if provide info appreciated. assuming have no companion computer (iris+ not default), ok running gr

c# - What is a NullReferenceException, and how do I fix it? -

i have code , when executes, throws nullreferenceexception , saying: object reference not set instance of object. what mean, , can fix error? what cause? bottom line you trying use null (or nothing in vb.net). means either set null , or never set @ all. like else, null gets passed around. if null in method "a", method "b" passed null to method "a". the rest of article goes more detail , shows mistakes many programmers make can lead nullreferenceexception . more specifically the runtime throwing nullreferenceexception always means same thing: trying use reference, , reference not initialized (or once initialized, no longer initialized). this means reference null , , cannot access members (such methods) through null reference. simplest case: string foo = null; foo.toupper(); this throw nullreferenceexception @ second line because can't call instance method toupper() on string reference pointing null .

c - Output Error When include file included twice -

[edit] seems people commenting , voting without reading post. please read before commenting. instance: if think against including files more once, missing point of post. i trap sloppy programming outputting error when include files included twice. i use #pragma once include files intend include within other include files. works great. i know can variation of "guard macros" accomplish this. there better way? #pragma or gcc compile option? this sample of guard macro: #ifndef file_foo_seen #define file_foo_seen entire file #endif /* !file_foo_seen */ this work me: #ifdef file_foo_seen #error "file_foo inappropriately included twice. #endif /* file_foo_seen */ #define file_foo_seen /* active code */ [edit] note: not asking why necessary support including header files multiple times. common case , supported gcc pragma. asking case when have specific include files not want included more once. if include them more once, 1 of 2 actions: 1) chang

ios - InAppPurchase doesnt work -

im making game , got problem: every time i'm making purchase in it, returns me failed transaction. call function start transaction: func buyproduct() { let payment:skpayment = skpayment(product: product) skpaymentqueue.defaultqueue().addpayment(payment) } i got several users in sandbox-testers , set price in-app-purchase free. what's problem? var product: skproduct! //used in viewdidload skpaymentqueue.defaultqueue().addtransactionobserver(self) self.getproductinfo() func productsrequest(request: skproductsrequest!, didreceiveresponse response: skproductsresponse!) { let products = response.products if (products.count != 0){ product = products[0] as! skproduct } } func getproductinfo() { if (skpaymentqueue.canmakepayments()){ let productid:nsset = nsset(object: "id.unique") let request:skproductsrequest = skproductsrequest(productidentifiers: productid set<nsobject>) request

c - Why does this code gives segmentation fault with some inputs? -

//difference of 2 diagonals of n x n matrix #include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int main() { int n, j, i,k,l; scanf("%d",&n); int array[n-1][n-1], sum1=0, sum2=0, sum=0; for(i=0;i<n; i++) { for(j=0; j<n; j++) { scanf("%d",&array[i][j]); } } for(k = 0; k<n; k++){ sum1 += array[k][k]; } for(l=0; l<n; l++){ sum2 += array[n-1-l][l]; } sum = abs(sum1 - sum2); printf("%d",sum); return 0; } the above code generates segmentation fault inputs. program calculates absolute difference between summation of values in 2 main diagonal. the main problem, think, you're declaring array of size n - 1 × n - 1 , filling in n elements. try declaring n × n .

rust - Is there a non-messy way to chain the results of functions that return Option values? -

i have code looks this: f(a).and_then(|b| { g(b).and_then(|c| { h(c).map(|d| { do_something_with(a, b, c, d) }) }) }) where f , g , , h return option values. need use intermediate values ( a , b , c , , d ) in do_something_with calculation. indentation deep. there better way this? ideally (which of course doesn't work): try { let b = f(a); let c = g(b); let d = h(c); do_something_with(a, b, c, d) } rescue nonexistentvalueexception { none } the rust standard library defines try! macro solves problem result . macro looks this: macro_rules! try { ($expr:expr) => (match $expr { $crate::result::result::ok(val) => val, $crate::result::result::err(err) => { return $crate::result::result::err($crate::convert::from::from(err)) } }) } what is, if argument err , returns function err value. otherwise, evaluates value wrapped in ok . macro can used in function

android - Why is the email Intent not working from Common (non Activity) class -

this code works in activity class, if move code common (non activity) class i'm getting error: calling startactivity() outside of activity context requires flag_activity_new_task flag. want? here code: public static void emailintend(context context) { intent emailintent = new intent(intent.action_sendto, null); emailintent.putextra(intent.extra_subject, context.getstring(r.string.string_email_send_feedback_subject)); string[] receipients = new string[1]; receipients[0] = context.getstring(r.string.string_email); emailintent.putextra(android.content.intent.extra_email, receipients); emailintent.addflags(intent.flag_activity_new_task); context.startactivity(intent.createchooser(emailintent, "send email developer...")); } and how calling activity: common.emailintend( getapplicationcontext() ); i tried replacing getapplicationcontext() this , no help. kindly, tell me if doing not corre

sql - Performance comparison on Join with OR on 2 predicates vs 2 separate joins 1 predicate each -

what's performance impact on using join using 2 predicates or on on clause so: select gs.guitartype,gd,guitarcolor prod.guitars gs left join prod.guitar_detail gd on (gs.guitarid = gd.guitarid or gs.guitarid = gd.guitarcatnum) vs. this: select gs.guitartype,gd,guitarcolor prod.guitars gs left join prod.guitar_detail gd on gs.guitarid = gd.guitarid left join prod.guitar_detail gd2 on gs.guitarid = gd.guitarcatnum couple caveats: have use left join can't use inner. i've ran both of queries , latter performs better. also question, 2nd won't return more rows right? because they're both being joined on same table, should both preserve gs table right? in first query have match twice? or why perform different second? let me answer in reversed order. also question, 2nd won't return more rows right? because they're both being joined on same table, should both preserve gs table right? the queries different (the diffe

Incrementally "scroll" container left/right on click with pure css -

i trying create pure css solution scroll set of elements incrementally right or left fixed value on click of href link. have basics working in can scroll right or left on click of corresponding button subsequent clicks toggle between initial positions. cannot increment multiple times left or right. remember, goal pure css please trying either render working poc or show javascript required can't done pure css. http://plnkr.co/edit/itgdeye8sfxtebhblycj?p=preview html <head> <link rel="stylesheet" href="style.css"> <script src="script.js"></script> </head> <body> <a id="left" href="#left">&lt;</a> <a id="right" href="#right">&gt;</a> <div class="f-slideshow"> <div class="items"> <span>1</span> <span>2</span> <sp

javascript - How do I add (push) items to an array one at a time (looping through array) -

Image
i can't figure weird problem out. link jsbin i'm trying add values array ( prices ), using click function. when user clicks button, adds pricing data javscript array prices . i need add multiple data entries @ once, contain price different day . this click function #add_pricing. $("#add_pricing").click(function(e){ e.preventdefault(); data = { "price": "1200", "days": ["1","3","4"] } adddata(data); console.log(prices) }); so when user clicks that, can see sends data variable adddata, is: function adddata(data) { (i = 0; < data.days.length; i++){ data.day = data.days[i]; //eg. data.day = "1" prices.push(data); } } so adddata() function loops through data.days , want push entry prices array, 1 @ time. but instead seems push 4 items @ time every itteration (you can see if log output) and doesn't set day varia

javascript - Make page scroll inside fixed DIV -

i have main div position: absolute . , fixed div . is possible scroll main div inside fixed div? once scrolling has reached end, begins scrolling parent. .container { position: absolute; top: 0; bottom: 0; left: 0; right: 0; overflow: auto; } .main { position: relative; overflow: auto; } .right { position: fixed; top: 10px; right: 50%; height:150px; width: 30%; background: yellow; overflow: auto; } jsfiddle basically want know first if user scrolling or down, setting oldscroll variable @ beginning of script ( 0 ) again @ end of each scroll event. compare oldscroll against current scrolling position. then check if user has reached end of scrollable area. if have, move scroll position 1 , set scroll position parent forward or backward amount (in example use 20). var oldscroll = 0; document.getelementbyid('scroll').onscroll = function() { if(this.scrolltop > oldscroll && this.scroll