I have got two div's for javascript, dyn1 and dyn2. Dyn1 on mouse over sets a interval and on mouse out clears the interval.
When the page loads it calls a function called 'first' and this displays a table in dyn1.
Then the user can click a link and this calls another function 'second' which deleted the table in dyn1 and creates a table in dyn2 and is suposed to clear the setInterval.
The problem is after a second of clearing dyn1 and creating the table in dyn2 the setinterval is still running and deletes dyn2 and re creates the table in dyn1.
Is it possible to stop a interval when the user clicks a link? At the moment the second function is calling the stoptimer() function to try and stop it.
I'm using jQuery to create a hover effect when a user hovers over a div. This is fine, as usual all browsers except IE do what I need of them. Inside my divs I have some text and to get the whole div area to be the link I have simply placed an anchor (last in the div in html) and abs pos'd it, given it a z-index and displayed it as block so that it is now the whole div as a link. But because of the text, IE is giving priority to the text so when I hover the div, if I hover into the text area it is taking the hovered stated off of the div. I need to stop IE bringing the text to the front. This happens in all versions of IE inc 9
I have a simple navigation system, and I am using hover, to show/hide details, but if I hover back and forth too fast between the elements, the animation queues up and keeps executing even when I am not hovering over them.
[Code]...
I can use stop() on animate to prevent queuing, but doing it like in the code above, stops the animation from even happening. Please suggest a solution.
I am working on an image changer. I found that if I do a fadeout/fadein on an element and then try to do another fadeout/fadein on the same element it does not work so I put my fadeout/fadein inside a function and do all my work in the callback portion along with a call to self to make the function keep running in a loop. I just need to know how to incorporate the hover function to make the script stop while hovered over a specific element (will be one of 6 image divs).
Here is the code Code: $(document).ready(function() { var newImage = 'img/1.jpg'; //starts the process with the first image (same as the one in css background-image) imgreplace(newImage); }); var files = new Array('img/1.jpg', 'img/2.jpg', 'img/3.jpg'); function imgreplace(newImage){ $("#imgbox").fadeOut(500, function(){ $(this).css('background-image' , 'url(' + newImage + ')').fadeIn(500); var currImage = newImage; .....
I need to get the randomness fixed because it is still returning the same image sometimes but other than that it works. I just need to be able to hault the function on hover and let it restart where it left off when I move the mouse away. In the unhover section I will be adding code to place an overlay image and href link but I don't think that will be a problem if I can get the start/stop working with hover. Actually I'm hoping to set some variable and use it in my getNewImage function so the other images continue to change but getting the entire script to stop so all the images stop changing will be OK.
Im playing around with some JQuery and have a small problem with my menu. I want the text to always be visible, be on hover and not on hover. Currently, the text is only visible when I hover the <li> item. Check it out at http://cooper.zxq.netBelow is my code using to produce the menu.
I've developed a plugin for a simple slide show. and here is the code [URL] The problem is when I mouse over the pic, the console error logs: "slideSwitch is not defined" The same error would still happen if I define function slideSwitch(){} and call
In the code below there is a set interval. The interval works perfect. There also is a clearInterval, this one works aswell. When I click on the button with the ID sluitinfonew the interval should be set again, this also works. But offcourse the clearInterval doesn't work anymore because the var is within the function(i'm not sure). Is there a better way to do this? I can't get it to work.[code]
I was trying to use a jQuery timer to repeat a function at intervals, but it didn't work in IE. Then I read that IE doesn't support setInterval, which seems amazing. Did I read this right? And if so, what do I use in jQuery to keep repeating a function at intervals? I've tried a few things and they all bomb out in IE, just doing something once, although they work in FF. What works in the execrable IE and real browsers?
I m trying to make a person stay on same page on cancel, but the confirm takes the user to the next page like they press ok. how can i stop it? code...
Umm, this is a tricky one to add a descriptive title for!
Basically I have two links on the page that go to the same page when clicked. What I want to do is when I hover over one of those links for the hover to work for both of them and visa versa.
when I call obj.loop(); 'this' in obj.next refers to setInterval and not obj . I realise I can add var ref = this; and send it with setInterval but is there something I can do to get 'this' to refer to obj when in obj.next?
I'm attempting to create a small function that when called upon will change the CSS background property 10 times at 80 millisecond intervals. I'm pretty sure setInterval() is the way to go about this, but I've been toying with my script for an hour and can't get anything to work.
At each 80 millisecond interval, the CSS background property should change like so:
I would normally just use the background-position property, but it seems the hyphen throws javascript for a slip. It's really not necessary for this function, but if there's a way to use hyphens, it would be good to know for future reference.
So this works ok in the sense that the animation is performed smoothly. But to my understanding it should expand the height of the box 1pixel every 1ms, so it should expand very quickly from the base height to the maxHeight limit, but I click on the link and it animates soooooo slooooowly -- smoothly, i mean, but it takes well over a minute to expand to the full height. I just need to speed the damn thing up! Also, if i change "box.heightCount++;" to "box.heightCount+=1;" it gets all messed up. What am I missing here?
i'm scratching my head over achieving similar results with setInterval() function, and how I can keep it from looping infinitely.
I want to do something like this: var i = 0; var endTime = now + ((1000*60)*2); // 2 minutes after now while (now <=endTime) { i = i + 1; now = new Date().getTime(); } document.write("total iterations: " + i);
however you can't do this because of lag issues, so i'll settle for using setinterval on its smallest interval of a millisecond, here is my attempt to translate the above to a setinterval solution: var endTime = now + ((1000*60)*2); // 2 minutes after now var intervalID = setInterval(loopFunc(endTime),1); function loopFunc(endTime,intervalID) { if (new Date().getTime() <= endTime) { i = i + 1; } else { clearInterval(intervalID); }}
as you can see I have prolbems figuring out how to stop the interval from continuing to iterate, and passing the interval id, I'm clueless Also I'm clueless on echoing the total iterations via this method.
I'm trying to build the framework for an AJAX back/forward button fixer. Basically it uses the hash fix for them (using text after the # to add history objects). To this effect, the function to check for updates has to be run every second or so. No problem, I'll just use setInterval for that.
For whatever reason, though, setInterval gives me an error. Specifically that oldLocation (global variable) is undefined (in the checkURL function). So I try setTimeout. Same thing. When I just call the function explicitly once (adding checkURL(); to the end of the script) everything works wonderfuly; it's just setting it up on a timer that messes up. Frankly, I've no idea why it's doing this. (The bug just seems so odd) Maybe a more advanced JS coder can shed some light on it.. Code:
is not working correct. doSomething is not known. i think, setInterval is not inside the class, so doSomething is private and unknown for the interval.