Jump to content

Ingolme

Moderator
  • Content count

    13,393
  • Joined

  • Last visited

  • Days Won

    4

Ingolme last won the day on April 15

Ingolme had the most liked content!

Community Reputation

868 Excellent

About Ingolme

  • Rank
    Foxy Mod

Contact Methods

  • Website URL
    http://www.thecodingfox.com/
  • ICQ
    0

Profile Information

  • Gender
    Not Telling
  • Interests
    Web development, drawing, videogames, foxes.

Previous Fields

  • Languages
    Java, PHP, MySQL, Javascript, CSS, HTML

Recent Profile Visitors

172,447 profile views
  1. return ajax data outside the ajax

    Due to its asynchronous nature, the AJAX response has to be processed in the callback function. There isno way around that. Is there a reason why you can't move those lines of code inside the success function?
  2. Style <ul>

    You can select any list and change its bullet images. You can also select individual <li> elements and set their bullet images.
  3. Can't Get Canvas To Rotate

    Just for reference, the rotate command and other transformations need to be called before drawing the image because it doesn't modify the existing content of the canvas, it just changes the frame of reference for the next objects that are going to be drawn. I can't see anything obviously wrong in your code, but I don't have all the information either. Just as a test, rotate the canvas only 45 degrees, then draw the image at position 0, 0 rather than 255, 255.
  4. Can't Get Canvas To Rotate

    It might be rotating around the top left corner of the canvas, if that's the case then the surface you're drawing on is outside of the boundaries of the image. You probably need to translate the origin before or after rotating. To make sure of this, try rotating just 45 degrees first and see what it looks like.
  5. var a = a || [ ];

    The OR operator in Javascript returns the leftmost operand that evaluates to a boolean true value. In the following code, the variable x gets set to 5 because 0 is false. var x = 0 || 5; When you assign a variable to itself nothing changes: var x = x; When a variable does not exist, its value is undefined which evaluates to boolean false. In the following code the variable x gets set to 5 because an undefined variable is false. var x = x || 5; In conclusion, the code var x = x || []; will do nothing when x already exists but will assign an empty array to x if it does not already exist. The reason that people creating embeddable scripts do this is to prevent the program from breaking when somebody embeds their code more than once in the same document.
  6. Array cloning

    The slice() method creates a copy of the array, it does not create a reference to the array. After the copy has been made, it can be changed without modifying the original array. /* Two variables pointing to the exact same array */ var a = ["a", "b", "c"]; var b = a; b[0] = "d"; console.log(a[0]); // Prints "d" /* A variable containing a copy of the array in another variable */ var a = ["a", "b", "c"]; var b = a.slice(0); b[0] = "d"; console.log(a[0]); // Prints "a"
  7. Responsive division

    Use CSS to set the border to zero, give it a height of one or two pixels and then give it a background color. CSS lets you style any element in any way, even the <hr> element. The specification only indicates how the browser should style the <hr> element by default when no CSS is applied.
  8. Matomo: async, defer, and insertBefore()

    It's not correct. Asynchronous is not about the order of execution, that is merely a side effect, but about whether or not the browser should halt loading the page when it comes across a script. HTML just tells the browser what scripts to load and how to load them. As for methods of loading Javascript, there are just two: synchronous and asynchronous. When a script is synchronous, the page stops loading at the point where the <script> tag ended, waits for the entire script to download, then runs the Javascript from the file, then continues loading the rest of the HTML. This really slows down the page from loading which is why it is recommended to have script tags at the bottom of the document or to load them asynchronously. If you load scripts synchronously in the <head> section then the page will be blank until the scripts are done downloading. When a script is loaded asynchronously, the page begins downloading the scripts but continues parsing the rest of the HTML on the page, waiting until the script has finished downloading before running it. The problem with this is that you cannot predict the order in which scripts will run: whichever script downloads the fastest runs first. The defer attribute tells the browser to remember the order in which scripts were in the document, but this behavior is only predictable if all script tags have the defer attribute and not just some of them. Most of the time, the defer attribute is not used for that purpose and instead is just used to be backwards compatible with old versions of Internet Explorer because it does not support the async attribute.
  9. Array cloning

    In the first example, if you change a, b will also change because they're both pointing to the same thing. In the second example, both a and b can be changed independently of each other because they're two different arrays that merely have identical content.
  10. HTML: Image displays after video background

    What your code currently does is to redirect the browser to an image when the video ends. What I think you actually want to do is to display an image in place of the video on the same page. For that, you need to have an <img> element on the page styled the same was as the video that's invisible. When the video ends, hide or delete the video and make the image visible using the style property or DOM methods. Another option is to use Javascript to set the background image property of the container after deleting the video.
  11. Padding around my Menu Items

    I thought they were all zeroed, but looking at the CSS again I notice the <ul> element does not have its left padding removed.
  12. Matomo: async, defer, and insertBefore()

    The use of both async and defer is often done because old versions of Internet Explorer only understood the defer attribute. They're not mutually exclusive, async tells the browser to continue loading the rest of the page while the script is being downloaded. The defer attribute works the same, but deferred scripts are executed in the same order as they are in the DOM rather than executing each one the moment they finished downloading. The async and defer properties are explained in detail on this page: https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement In short, x.parentNode.insertBefore(y, x) means to put y right before x in the document. It doesn't matter what or where x or y are as long as they're both DOM nodes. The insertBefore method works like appendChild(), but instead of putting it at the end of the children, it specifies one of the existing children of the node before which the new element should be inserted. W3Schools has a page explaining the insertBefore() method here: https://www.w3schools.com/jsref/met_node_insertbefore.asp
  13. My CSS isn't working as expected

    That might be the visited link color. To be sure, you should open the developer tools and check the element. In most browsers you can find the development tools by pressing F12 on your keyboard.
  14. Padding around my Menu Items

    Without seeing the page itself, or at least the HTML, I can only make guesses. It looks as if there are more elements than the ones that your CSS is styling.
  15. Testing a radio button ON or OFF?

    Then look at the browser console for errors and find why it's not working.
×