JQuery :: Else Statement Slowing Script ?

Jan 29, 2011

I have this demo here: [url]

It's three div's stacked on top of each other. When you scroll the page the div most central will change opacity and the other div's will have a lower opacity.


The problem with this is the speed - the transition can be really slow and the speed can vary between div's

I have another demo here, where the speed is better - the divs change opacity almost immediately.


The problem here is I can't get the div to change back to there lower opacity without effecting the speed. This code dosen't have the else statement that was changing the div's to there lower setting.


How can I change the opacity of the div's to the lower opacity without the else statement, which seems to make the whole thing slow.

View 4 Replies


Jquery :: Shadow Slowing Things Down?

Oct 24, 2009

I'm developing a website utilizing Jquery Drop Shadow and thickbox and other things. I just implemented the thickbox and thought that maybe the slow response was my system (I've had photoshop, 12+ browser windows up, etc). I realize that may not be the case and I suspect jquery's drop shadow is a hog. I don't want to go through the entire code and implement a different shadow method at this point. Instead I'm wondering if anyone can verify this issue

[URL]... Click on the "Film Reel" and it may be especially slow to load. If you suspect it is my use of the Jquery Drop Shadow, can you recommend ways I could optimize it? One idea I have is to toggle it off and on when thickbox is opened and closed. However I don't know how to do that yet.

View 4 Replies View Related

Css Slowing Down My Preload??

Dec 23, 2005

I'm not sure if this is a CSS question or a JS question, but I have a rollover image gallery using css for style and js for the behavior.

The css I'm using is meant to crop the thumbnails into perfect squares. However, it seems to also be slowing down the rollover.

View 9 Replies View Related

Slowing Down The 'drag' - Make The Boxes Move More Smoothly

Mar 19, 2010

I have found a wonderful script at: [url]

But it seems that you can only move the boxes if you click them and then move them really really fast, otherwise they don't react... I looked at the js file but I can't figure out what to change in order to make the boxes move more smoothly...I can't place the js file because its to big...

View 4 Replies View Related

If Statement Returning False On A True Statement?

Apr 4, 2011

my webstie allows users to change the color of the background, so to keep the text readable I have it changing as well.the color picker I am using has text boxes with rgb values 0-255 for each.I am trying to get one bit of text to alternate between red and blue with the conditions

if(blue>green && blue>red)


View 2 Replies View Related

JQuery :: Use To Indicate The End Of The JS Statement?

Jul 13, 2010

For the following two snippets, they can all pass Firefox.However, I would like to know the rule of thumb when I have to use ; to indicate the end of


View 1 Replies View Related

JQuery :: Using If Else Statement With Mouseover

May 14, 2010

I'm trying to stop my script running if someone mouses over a link with the class .focus.
The code:
$(document).ready(function() {
window.setInterval(function() { //Every 3 seconds do this function
if ("a.focus").mouseover(function() {
//Do nothing
}) else {
$(".list li:nth-child(3)").children().toggleClass('focus'); //Remove class from <li> #3
$(".list li:last").css("height", 0);
$(".list li:last").prependTo(".list").animate({ //Put last <li> to the top of the list and animate the height from 0 to 48
height: 48,
},200, function(){
//Animation Complete
$(".list li:nth-child(3)").stop().children().toggleClass('focus'); //Add class to <li> #3
}}, 3000);});

View 2 Replies View Related

JQuery :: If Statement - How To Get Value Of Textbox

May 26, 2010

I'm quite new to jquery, but as I understand it, .val() shouldn't be this difficult. Right, I have to use asp.net, I have a textbox that looks like this:
<asp:TextBox ID="txtRow021" runat="server" CssClass="tbOneNumber"></asp:TextBox>

I am trying to get the value of this textbox to give me the length of the textbox to use in an if statement:
both alert($("#<%= txtRow021.ClientID %>").val()); and alert($("#<%= txtRow021.ClientID %>").val().length); always seems to return "" and 0.

View 1 Replies View Related

JQuery :: Applying Variable To If Statement?

Jun 17, 2010

Need to apply a var to a statement if its conditions are met, this syntax isn't throwing errors but its not working.

<script type="text/javascript">
var action_is_post = false;
//stuff here


should I use something other than .ready? I need it to apply the var when #stepDesc0 has the class current.

View 9 Replies View Related

JQuery :: Can't Select A Class In An If Statement?

Aug 19, 2010

I'm trying to create a form validation that will alert the user if the dropdown lists contains empty valuesbut nothing happens with my code.What's wrong with it?

if ($('.required').val=='')


View 7 Replies View Related

JQuery :: For Each Statement - Hover Over Popups

May 4, 2010

I am a javascript newbie and trying to write a script to create hover-over popups for a product page. It works like a charm when I assign it a solo "div#id" and "a#id", however I need it to work on multiple objects.I can't use a classbecause then everything with the classname pops up at the same time. So each popup HAS TO have a unique ID. I am trying to write a for each statement, but it doesn't seem to be working... any ideas... or better ways to execute this...

This is the one that works (but only for one):
<script type='text/javascript'>
$( 'a#popup').hover(function(){

This is my current for each equiv (Not Working):
<script type='text/javascript'>
for (i = 1; i < 12; i++){
varthis_a='a#popup' + i;
varthis_div='div#popupBox' + i;

View 2 Replies View Related

JQuery :: GetJson Works Until Add A WHERE Statement

Sep 8, 2011

I'm finally trying to get a grasp on json. I have some working code but when I add a WHERE statement the callback doesn't seem to happen.


$.getJSON('ajax/cs.php?callback=?', function (data) {
$.each(data, function (i, item) {


View 3 Replies View Related

JQuery :: Getting The Most Basic Statement Working?

Mar 8, 2011

I've got the following code block in one of my pages ...

if ($config->theme->short_name == 'default')
<script type="text/javascript">


Shouldn't the code above set the .html property of the element with class "error_box" to the specified text? I've tried using an id instead of a class i.e. $('#error_box").html(...) but that doesn't work either. I've also tried using the .text() method.

Manually using document.getElementById("error_box") works without any problems - it's only jQuery that won't do what I tell it. :-)

View 2 Replies View Related

JQuery :: If Else Statement Inside Each Loop

Aug 3, 2010

I'm currently trying to produce an HTML table from an XML feed, using jQuery. And this works great! With an "each" loop, there now is a nice table on my screen, displaying the right information from the feed.

I would like for each new row of this table to have a separate color. For example:
row 1 - blue
row 2 - green
row 3 - blue again
row 4 - green again
and so on...

What I've tried, is putting something like this inside the loop:
(this line should probably be outside of the loop, but that doesn't seem to work)
code 1...
code 2...
But this doesn't work.

View 2 Replies View Related

JQuery :: If-statement Dosnt Work?

Feb 24, 2011

WhatI want to do: IfI hover over a tab (there are 3) all other tabs will close.Below is thecode for the first tab

{(function () {
$("#box1").animate({ width: "500px" }, 400 )


View 10 Replies View Related

JQuery :: If Statement Radio Button?

Oct 5, 2010

The function below hides and shows the rest of my form fields (when I don't use the if statement). I wanted to try to make an if statement so that when I reload the page, I don't have to reselect the radio button when it is not null. I want to have an if statement that says, if the radio buttons are null, hide the form fields. If it is not null, just maintain the current state. Unfortunately, I couldn't get the function below to work.

$(function (){
if ($('input.radioalign[value=""]')) {


View 2 Replies View Related

JQuery :: Can The Click() Function Be Used In An If Statement

May 25, 2009

I would like to know whether a jquery click function can be used in an"if" statement.The reason why I am asking, is because I haven't seenany examples of this being done on the web. I want to use thisapproach because currently Jquery keeps initiating two events from onemouse click, eventhough the css for each element is different.Ithink the best way to avoid this problem is to use flow control toexclude the other mouse click event. If element A is clicked then

View 3 Replies View Related

JQuery :: How To Use If Statement With Hover Event

Aug 30, 2008

I am trying to use a if not statement but trying to use the condition of jquery hover. I have an image and when you put your mouse over it another image appears this image that appears using css would be a menu look however I notice that when I move my mouse off the image to the menu image that appears when your mouse is over the persons image it would then fade away.

Clients image when mouse is over the image another image appears the new image that appears is a menu image with buttons on it this was created in html and position with css so it appears next to the persons image. The problem I have is when you move your mouse off the users image to put it on that menu the menu would fade back out. So I want to make a if not stating that if the mouse is not on the user image or the menu that appears then you fade out. How can I do this??

View 1 Replies View Related

JQuery :: Passing Variable Into YQL Statement?

Apr 17, 2011

I'm having a tough time trying to add the "zip" variable to my YQL statement.

var zip = $(this).attr('zip');
$.YQL("select * from rss where url='http://weather.yahooapis.com/forecastrss?p=' ' "+ zip +" ' ", function(data){
var w=data.query.results.item;


I've tried as many different ways as I could imagine. Simply putting the literal zip code in the query works perfect.

View 2 Replies View Related

JQuery :: Using IF Statement To Trigger AddClass()?

Dec 17, 2010

I want to add a class to a navigation button, based on the position of my sliding <ul>.

The addClass("not-active") works when the page first loads, but when the <div class="button next"> is clicked, the position changes, and so I want the evaluation of the if statement to change (and thus trigger the addClass("active"). That's not happening. (I realize this would give me both the active and not-active classes -- I'll deal with removeClass later.

HTML and jQuery is below:

<div id="wrap">
<div class="button prev">Previous</div>
<div id="slider">


View 1 Replies View Related

Jquery :: Input A Variable In If Statement?

Dec 1, 2010

Below is a working code.

1. if($('input[name="test"]').is(":checked"))
2. {
3. // my other code
4. }

I want to remove "test" and put a variable there instead

I tried this way but it does not seem to work.

1. newData="test";
2. if($('input[name=$(newData)]').is(":checked"))
3. {
4. // my other code
5. }

View 3 Replies View Related

JQuery :: Adding Event For HTML Statement

Nov 20, 2011

I am using a dialog box plugin. I need to add a button so I use html statement like below:
'<input id="myButton" type="button" value="test" />'
This renders just fine but I don't know how add an event for the button or even add this button to the DOM.

View 1 Replies View Related

JQuery :: Combining .ready And .change In An OR Statement?

Jul 18, 2011

I've got identical javascript code that I want to run when either a page loads or inputs to a form change. Right now, I've got two separate statements:


I think the obvious answer is to combine the two with a Javascript IF/OR (||) statement, but I can't seem to get the syntax correct, I think probably due to the open '(' before 'function' in both cases and the fact that it doesn't close until 'some javascript' has executed.

Any suggestions on the correct syntax, or is there a different way of implementing this that I'm not aware of? The two separate statements work fine right now, but I'd rather not have to maintain multiples of the same javascript code.

View 1 Replies View Related

JQuery :: Conditional Statement In $.ajax Call

Dec 28, 2010

I'm trying to write a modal login script which I borrowed from the SimpleModal site. Unfortunately, I'm running into a very frustrating problem.

When the user types in a valid login/password combo, the PHP function do-login.php echos back "OK". That being said, here's a snippet of my jQuery code:

type: "POST",
url: "do-login.php",
data: str,


The do-login.php script DOES echo back "OK"- I verified that with Firebug. But even though it echos back "OK", it goes to the 'else' clause.

I tried using return instead of echo but that didn't help either.

View 18 Replies View Related

JQuery :: FAQ Show / Hide Function - If Statement

Jun 24, 2010

I have a simple FAQ show/hide function set up however I am having trouble setting up an if clause. My code is:

However, when you click on the same item twice it firstly hides and then reshows it, I need an if statement that basically states;
if "this?!" is visible/shown
Then do nothing
I am unsure of the syntax and can't figure out what property I can trace out to see if the item is being shown or not.

View 4 Replies View Related

JQuery :: If Statement And Passing Click Event

Mar 16, 2010

I got a pretty large function, one that could essentially be condensed (if you feel so inclined). I would like to know how I can get my if statements inside the toggle functions working properly. I have 4 functions and 2 of them are click functions for closing (display:none). I would like to pass a listener to the toggle funciton to listen for the $close.click(). The if statement in the toggle functions is not doing anything.

<script type="text/javascript" >
var $contactLink = $("#contactLink");
var $contactBox = $("#contact-container");
var $qrLink = $("#qrLink");
var $qrBox = $("#qr-container");
var $qrBack = $("#qrBack");
var $contactBack = $("#contactBack");
alert('here'); .....

View 2 Replies View Related

Copyrights 2005-15 www.BigResource.com, All rights reserved