Hey I need to have a function run only once when the user scrolls. My problem is that I can't seem to figure out how to get .scroll to only check for that first scroll. I have come up with a working solution using a count, but I am hoping there is a better way to do it. I assume that it checking for a scroll constantly is just a waste of resources. My solution doesn't fix that problem, it only makes sure the function runs once. Here is what I have:
Can anyone tell me how to check against multiple URLs in just one if statement?
Example that doesn't work:
$(document).ready(function($) {
if (window.location.href.indexOf('google.com/' || 'yahoo.com/') != -1) {
alert('matched URL');
else {
alert('URL not matched');
});
What I can do that DOES work is:
$(document).ready(function($) {
if (window.location.href.indexOf('google.com/') != -1) {
alert('matched URL');
}
else if (window.location.href.indexOf('yahoo.com/') != -1) {
alert('matched URL');
else {
alert('URL not matched');
}
});
My problem is that I would like to try matching against a quite a few URLs, and I assume/hope there must be an easy way to do with just one if and else. Does anyone know of a solution? Thanks!
According to jQuery's Queue Info, it should wait to .remove() until after the .fadeTo completes. However, I am not getting this result. It removes before I can even tell if it fades at all. Does anyone know why? My best guess is that because .remove() might not be a "fx" it is on a separate queue or something?
Just an FYI, I only need this to work in Google Chrome. That probably doesn't matter, but just don't trouble yourself into fixing for IE or anything.