Jump to content

Search the Community

Showing results for tags 'callback'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 5 results

  1. I have several different pages that all need access to the same XML data file. I'm trying to use this fairly-standard function to load the file when the page loads. If I call getXMLFile() from within each pageLoadFunction, it works, but I'd like to use it to set up some other vars and avoid duplicating code. getXMLFile = function(callback) { var request = new XMLHttpRequest(); request.open("GET", "MyFileName.xml"); request.setRequestHeader("Content-Type", "text/xml"); request.onreadystatechange = function() { if (request.readyState == 4 && request.status == 200) { callback(request.responseXML); //Does code needed for all pages go here? Or where? } }; request.send(); } What I would like to do is put something like this in my HTML, using a callback to call the fill function after the file has loaded: <body onload="openXML(fillPageFunction)"> <!--There is a unique fill function for each page--> OpenXML() would call getXMLFile() to load the data, then make use of it. Procedurally, here is what I want to happen: Use getXMLFile() to load the data file Go ahead and render page HTML/CSS while file is loading When file is loaded, use it to fill some global vars needed on all pages Call a fill function to fill fields on the specific page I've spent hours studying manuals, tutorials, and examples on using callbacks, but my procedural brain still can't make them work. Can someone familiar with callbacks please show me how I could accomplish this? (Using named functions, rather than anonymous, would probably help to make it clearer to me.) To fill vars needed on all pages, would I put that code right after the line "callback(request.responseXML);"? Or where? To fill fields on specific page I would call a unique fillPage function for each page. Where would I do that? Can I make that function a param to openXML()?
  2. I have an intersection observer for one animation, but i want to use window.requestIdleCallback() Where I should add the code window.requestIdleCallback(callback_1)? my script: if (document.querySelector('#weddings')) { let observer_1; let Element_1; let prevRatio = 0.0; let options = { root: null, rootMargin: "0px", threshold: buildThresholdList() }; // Set things up Element_1 = document.querySelector("#img-1"); initObserver(); ////////////////////////////////////////////////////////////////////////////// function initObserver() { observer_1 = new IntersectionObserver(callback_1, options); observer_1.observe(Element_1); } ///////////////////////////////////////////////////////////////////////////// function buildThresholdList() {...} ///////////////////////////////////////////////////////////////////////////// var gallerySroll_1 = anime({...}); //////////////////////////////////////////////////////////////////////////// function callback_1 (entries, observer_1) { entries.forEach((entry) => { if(entry.boundingClientRect.top <= 0 && entry.intersectionRatio != prevRatio){ gallerySroll_1.seek(gallerySroll_1.duration * (entry.intersectionRatio)); }else{ gallerySroll_1.seek(1000); } prevRatio = entry.intersectionRatio; }); } } if I add the code at the start after the if before anything i got the error: TypeError: entries.forEach is not a function callback_1 https://alessiopaolettidesign.it/ph/js/main.js:343
  3. Hi, I don't understand how to pass the value of profileImgX and profileImgY to the spot indicated below: function drawProfileImg() { profileImg = new Image(); profileImg.onload = function() { profileImg.x = canvas.width - distanceFromRightSide - ((profileImg.width - 183) / 2); profileImg.y = canvas.height - distanceFromBottomSide - ((profileImg.height - 242) / 2); profileImgAnimation(); } } function profileImgAnimation() { setInterval(function() { // I would like to pass the value of profileImgX and profileImgY here context.drawImage(profileImg, profileImgX, profileImgY, profileImg.width, profileImg.height); } } Thank you
  4. edcowan

    Postback file

    i am using gwallet on my site from http://radiumone.com/one step is to add a callback url that can p[erformWe will send the following parameters to your Postback URL every time a user completes an offer or payment:• appId is Application ID of your application on RadiumOne Social• userId is the user ID value you've passed to us on iFrame call• amount is the transaction amount of your virtual currency• hash is MD5 hash you can use to verify the postback, calculated as md5([uSER_ID]+":"+[APP_ID]+":"+[sECRET_KEY]), where "+" is string concatenation and [sECRET_KEY] is the secret key of your application• trackId is the tracking value you passed to us on iFrame callNote: Your reply must be a single character 1 on success or 0 otherwiseanyone know how to make a php file do this?
  5. I've got the simple code to write out the text of the new position of the div: var posTeller = $('.movingDiv').position();$('span').text(posTeller.left) $(".buttonClass").click(function(){ $(".movingDiv").animate({left: '+=20'}, 500,function() { posTeller = $('.movingDiv').position(); $('span').text(posTeller.left); });}); However, I would like to have it update as it's moving. I will need this later so that an 'if' function can catch it at a certain value and stop the animation mid-way and call a new animation. I found the $.throttle plugin but I'm unsure how to implement it based off the examples. The end purpose is preventing a slide of thumbnails from going too far and 'bouncing back'. Throttle Plugin Thanks!
×
×
  • Create New...