javascript window.addeventlistener load

javascript window.addeventlistener load

How to load window.addeventlistener in JavaScript?

View Answers

September 20, 2011 at 1:11 PM

window.addEventListener('load', function() { 

  var b = document.getElementById('box'),  
      xbox = b.offsetWidth  / 2, // half the box width 
      ybox = b.offsetHeight / 2, // half the box height  
      bstyle = b.style; // cached access to the style object  

  b.addEventListener('touchmove', function(event) {  
    event.preventDefault(); // the default behaviour is scrolling    
    bstyle.left =  event.targetTouches[0].pageX - xbox + 'px';   
    bstyle.top  =  event.targetTouches[0].pageY - ybox + 'px';  
  }, false);  

}, false);









Related Tutorials/Questions & Answers:
javascript window.addeventlistener load
javascript window.addeventlistener load  How to load window.addeventlistener in JavaScript?   window.addEventListener('load', function() { var b = document.getElementById('box'), xbox = b.offsetWidth / 2
how to load value in dropdown list after selecting value from first dropdown list using javascript
how to load value in dropdown list after selecting value from first dropdown list using javascript  how to load value in dropdown list after selecting value from first dropdown list using javascript
Advertisements
JavaScript
JavaScript  clone JavaScript
Ajax Load
Ajaxload The ajaxload is a tool, which follow web2.0 standard. Due to slow Internet speed or delay some times data takes time to load. At this time we can incorporate an animated gif image, which indicate user for the loading
javascript
javascript  javascript code to dynamically add table on button click.../javascript/javascriptexamples/javascript-add-row-dynamically.shtml http://www.roseindia.net/javascript/javascript-add-row-to-table.shtml http://www.roseindia.net
Javascript
Javascript  How validations are done using javascript ,with example? and interview questions on javASCRIPT
JavaScript
should use JavaScript? Thanks   Hi, JavaScript is scripting language that runs on browser. You have to embed JavaScript in HTML page. Please see JavaScript tutorial. Thanks
JavaScript
JavaScript  how to get full path of a file type in javascript
javascript
javascript  Hi deepak, how to write form validation on javascript
javascript
javascript  write a program to display implement about browsers using javascript
javaScript
javaScript  How to open a browser window that cannot be resized? (HTML + Javascript
javascript
javascript  i have just learned javascript... can you tell me what kind of applications can be made by javascript?? thank you
Load UIImage from URL
Load UIImage from URL  Load UIImage from URL
how to load pdf on html
how to load pdf on html  how to load pdf on html
Load Icon Image Exception
Load Icon Image Exception  Load Icon Image Exception
javascript
javascript  how to set the request or session attribute in javascript head part of jsp page
javascript
javascript  Hi sir, This is sinduri, i want to learn javascript, so plz can u help me.how to learn
javascript
javascript  hi sir, if i want to learn javascript. what concepts i want to know
JAVASCRIPT
JAVASCRIPT  I have one textbox and I want to validate that it must start with number(1-0). can anyone tell me a javascript for that ? thanks in advance
Javascript
Javascript   Javascript to check Numeric entry in checkbox.....   Hi Please find the following code for numeric entry validation in javascript function validateBox(){ var data=document.myForm.someText.value
javascript
javascript  hi, I was actually working on to calculate the number of days between two dates of yyyy-mm-dd format using javascript, and when i click on button then number of days should be display in textbox
javaScript
javaScript  . Print a table like below in JAVASCRIPT 5 x 1 = 5 5 x 2 = 10 ΓΆβ?¬Β¦ΓΆβ?¬Β¦ΓΆβ?¬Β¦. 5 x 20 = 100
javascript
javascript  passing javascript values to jsp   Hi Friend, Try the following code:ADS_TO_REPLACE_1 form.jsp: <html> <script>... Javascript value In JSP"> <% String st=request.getParameter("msg"); if(st
Javascript
this format xxx-xxx-xxxx, i want the code in javascript. as a function.   Javascript Phone Number Validation <html> <script> function..." method="post" onsubmit="javascript:return validate();"> Phone Number:<
Javascript
Javascript  Dear Sir, Thank You a lot for your continuos support.Again i am in need of your help. What is the javascript code to disable a link,once... javascript or css Please help me.Urgent Regards Debasis   Hello Friend
ModuleNotFoundError: No module named 'load'
ModuleNotFoundError: No module named 'load'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'load' How to remove the ModuleNotFoundError: No module named 'load' error
nsstring load from file
nsstring load from file  Hi, How to load file data into NSString object? Example of nsstring load from file, basically the html file data into NSSTring object. Thanks
jQuery Ajax load request
jQuery Ajax load request  Hi, How to use jQuery to send the request on server to load data in web page? Thanks   Hi, In the jQuery Load... and then load the data in web page. Thanks
date in textbox on page load
date in textbox on page load   i want to insret the current date... <script type="text/javascript"> function addDate...;/html>   Here is a javascript code that insert the current date
Javascript
Javascript  <html> <head> <script type="text/javascript"> function validateForm() { var sname=document.getElementById('spocname'); var scontact=document.getElementById('spoccontact'); if(sname.value.length
UIWebview load url
UIWebview load url  How to load website url in UIWebview? Tell me code for UIWebview load url of a website Thanks...: //Load web view data NSString *strWebsiteUlr = [NSString stringWithFormat:@"http
javascript
javascript
javascript  how to create random question using javascript?   <html> <script> function displayQuestions() { document.getElementById("text").value=" "; var Questions = new Array(20
javascript
javascript
javascript  Hi deepak, sample example on javascript form validation   <html> <script> function checkName(text) { if(isNaN(text)){ return 1; } else{ alert("Please enter a valid name. The only charachters
load more with jquery
load more with jquery  i am using jquery to loadmore "posts" from my... box its is going to display php posts and after that when i click on load more...; <script type="text/javascript" src="jquery-1.4.4.js"></script>
XML load problem - XML
XML load problem  I have load the xml document in javascript.getting error like ActiveXObject is undefined.Can you help me?  Hi friend... function load(){ var loadXML = new ActiveXObject
Load on Startup - JSP-Servlet
Load on Startup  Hi, Can anybody explain the exact use of load-on-startup tag. Where exactly we have to write. Thanks, Naveen  ... of a deployment descriptor is used to load a servlet file when the server starts instead
J2me Map load error
J2me Map load error  Hi , i am making a POC to load google map in my mobile,now i m getting the address of location by its lattitude and longitude in web page , but thing is i wana to store in my net beans emulator , its showing
Hibernate Session Load
This section contain description of Hibernate session load
load and upload. - JSP-Servlet
load and upload.  dear sir, plz give me the sol for my problem.i m waiting for u r reply. why u not replying ..   Hi Friend, We haven't remember your problem. So please send it again. Thanks
session on page load
session on page load  holding session on page load and reload..   <?php session_start(); if (!isset($_SESSION['arr']['counter'])) { $SESSION['arr']['counter'] = 0; } else { $SESSION['arr']['counter']++; } var_dump
load and upload. - MobileApplications
load and upload.  Dear sir/mam, i want code for java based application, that can take .3GP video file and upload it to youtube using youtube's APIs. The video file would be located on a weblink (a direct http link to a video
Form Should not load
box after submitting or the form should not load again. Thanks in adbance
Load function ***PLEASE HELP
Load function ***PLEASE HELP   Hi I am writing a program that tracks... a load function that prompts the user for the file name to be loaded and then it loads the stats. Here are the exact instructions. LOAD: Prompts the user
ModuleNotFoundError: No module named 'django-load'
ModuleNotFoundError: No module named 'django-load'  Hi, My Python... 'django-load' How to remove the ModuleNotFoundError: No module named 'django-load' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'lazy-load'
ModuleNotFoundError: No module named 'lazy-load'  Hi, My Python... 'lazy-load' How to remove the ModuleNotFoundError: No module named 'lazy-load' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'load-confounds'
ModuleNotFoundError: No module named 'load-confounds'  Hi, My... named 'load-confounds' How to remove the ModuleNotFoundError: No module named 'load-confounds' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'load-remote'
ModuleNotFoundError: No module named 'load-remote'  Hi, My Python... 'load-remote' How to remove the ModuleNotFoundError: No module named 'load-remote' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'load_resources'
ModuleNotFoundError: No module named 'load_resources'  Hi, My... named 'load_resources' How to remove the ModuleNotFoundError: No module named 'load_resources' error? Thanks   Hi, In your python

Ads