Jump to content

sunwukung

Members
  • Content Count

    39
  • Joined

  • Last visited

Community Reputation

0 Neutral

About sunwukung

  • Rank
    Newbie
  1. Hi all, I wonder if anyone can help me with this script:As it stands, the image fades out on mouseover, and reappears on mouseout (with a delay to prevent flickering). However, the effect only appears to work if you allow the opacity to fully decrement/increment to a maximum value. If the user (me...) makes rapid mouse movements, the function comes to a halt and stops fading. I figure either I need to add an event listener, or somehow I need to drop override/cancel the previous event.JS //Fade Test ScriptaddLoadEvent(event);// EVENT HANDLER//---------------------------------------------------
  2. sigh....Nope, still don't get it. Here's how I've structured my code. I'm guessing you can see what I'm trying to get at - can someone take a look at it and point me in the right direction? JFTR, it causes a too much recursion error at the moment, JAVASCRIPT <!--//--------------------------------------------------------------//FUNCTION animateLink//--------------------------------------------------------------function animateLink(element,value) { //clear out any backlog of commands on mouse events if(element.movement) { clearTimeout(element.movement); } //acquire xpos from offsetLeft (
  3. http://www.switchonthecode.com/tutorials/j...-and-settimeoutI found this interesting tutorial that talks about scope and this with relation to setTimeout. I think the problem with my original is an issue of scope...perhaps.
  4. I had a go at modifying your script to modify the position of a series of list elements - and it's no longer working. Maybe there's a problem animating list elements themselves?you can see the result herehttp://www.marcusk.co.uk/javatest/example1.htmlThis is a halfway house between the two (making the position relative and removing the top positioning seemed to speed it up...)http://www.marcusk.co.uk/javatest/example2.html<EDIT>I changed the position attribute to absolute again for the list elements and it works now...phewhttp://www.marcusk.co.uk/javatest/example3.htmlStrange though, bec
  5. okay, I'll give that a whirl. Thanks for your help, I'm really keen to understand JS and the DOM rather than rely on effects libraries. I like to know how the genie gets in and out of the bottle if you know what I mean..
  6. could you explain that a bit more for me? Maybe the problem is I've just spent 4 months learning PHP, so the whole javascript thing is a bit left of center.I just changed the example before your last post - if I change this line iteration.style.color = "red"; I get an error stating that the iteration element is undefined. If I replace that code with a simple alert however, i.e: alert(iteration); I get an alert box saying "undefined". So the manner in which I'm trying to pass the individual array element to the function is obviously wrong, I just can't figure out how I'm meant to construct
  7. I'm struggling to understand how to pass an array iteration to a function in Javascript. In the example, I've attempted to perform a simple change to the element styling - something better achieved through simple CSS, but this is purely to demonstrate the problem in a simple manner. In the long run, I want to be able to strap a fancy animation effect to this element.HTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Function
  8. Ah, I didn't know I could pass an anonymous function to the setTimeout function. I'll give that a whirl (and amend the xpos values...doh!)thanks. The main problem I'm getting with my current code is that animateLink is reporting "elem is null" - so I'm guessing somehow my attempt to pass the current link identity to the second function is going awry.
  9. Cheers, I already use regular CSS to make two state icon changes. This is just a prelude to an animated link menu, I stripped out all the fluff to make it easier to track the bug. I think what's happening is that I should pass the 'i' variable between the onmouseover functions.
  10. Hi againI'm really struggling with this code, been wrestling with it for a few hours, checking tutorials and having failed to grasp the concept of animation, I'ce decided to try my hand here:I have a series of links that i want to animate as the mouse passes over them. However, I am unsure as to how to pass variables from one function to another:The HTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Animated Menu</title&g
  11. doh!seen it now, it's my window.onload...should read window.onload =(imageMove); sorry to bother ya
  12. Hi all, I've managed to learn a decent amount of PHP , and so now I'm trying to learn some Javascript. So far I've found it quite difficult. Can you help me with this basic problem. I want to apply a style to an image through the script - here's an examplethe HTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Image Test</title> <link rel="stylesheet" media="screen" type="text/css" href="css/screen.css" /> <sc
  13. Doh!!Managed to solve this one - it's the header. The header uses Location:'http://domainname' - and by omitting the 'www' it is seen as a different/sub domain, thus generating a new session.
  14. HiI'm having a problem with my sessions. When developing locally, my scripts work fine - but on the server they aren't passing the session data correctly. I'm having to use ini_set to save cookies in a specific directory on the host. When I move to the second script, using a header:Location protocol - it generates a new session that is empty.In a nutshell: //script1.........................ini_set('session.save_path','./session/');session_start();$_SESSION['message'] = 'blah'; Then on another page ini_set('session.save_path','./session/');session_start();if (isset($_SESSION['message']){$msg
  15. Yeah, that's where I used the ini_set function.
×
×
  • Create New...