473,545 Members | 666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

jQuery show hide needs speed added for slideUp

9 New Member
This function swaps images between a close & replay GIF. Line 12 has a speed of 1 second specified for the slideDown, but no speed specified for the slideUp so it is defaulting to normal. I tried adding if(!isDown) slideTimeout = setTimeout(togg leSlideboxes, 3000 : 1000); to line 21 but ended up with a syntax error.

Expand|Select|Wrap|Line Numbers
  1. jQuery.noConflict();
  2. jQuery(document).ready(function(){
  3.   var slideTimeout //timer
  4.      , sbTrigger = jQuery('#slidebartrigger') //convenience
  5.  
  6.      , sbFirstSlide = (document.cookie.indexOf('slidedToday') == -1) //check cookie for 'already seen today'
  7.      ;
  8.   function toggleSlideboxes(){
  9.     if(slideTimeout) clearTimeout(slideTimeout);
  10.     var isDown = sbTrigger.is('.closeSlide');
  11.  
  12.     jQuery('#slidebar')['slide' + (isDown ? 'Up' : 'Down')]((isDown ? 3000 : 1000), function(){
  13.  
  14.         if(sbFirstSlide){ //if 'first time today' then clear for click-to-replay
  15.           sbTrigger.removeClass('firstSlide');
  16.           sbFirstSlide = false;
  17.         }
  18.  
  19.         sbTrigger[(isDown ? 'remove' : 'add') + 'Class']('closeSlide').one('click', toggleSlideboxes);
  20.  
  21.         if(!isDown) slideTimeout = setTimeout(toggleSlideboxes, 3000);
  22.  
  23.       });
  24.  
  25.   }
  26.  
  27.  
this is the relevant CSS

Expand|Select|Wrap|Line Numbers
  1.  #slidebartrigger {
  2.  position:relative;
  3.  background:  url(http://cincinnati.com/test/img/replayBlack.gif) no-repeat right top;
  4.  display: block;
  5.  padding: 0;
  6.  height: 13px;
  7.  width:53px;
  8.  float:right;
  9.  margin-top:-14px;
  10.  z-index:2;
  11. }
  12. #slidebartrigger.closeSlide {
  13.  background:  url(http://cincinnati.com/test/img/closeBlack.gif) no-repeat right top;
  14.  display: block;
  15.  padding: 0px;
  16.  height: -14px;
  17. }
  18. /* this is purely so that replay.jpg isn't showing during during the initial slideDown...*/
  19. #slidebartrigger.firstSlide {
  20.  background: url("http://cincinnati.com/test/img/blank.gif") no-repeat right top;
  21.  display: block;
  22.  padding: 0px;
  23.  height: 14px;
  24. }  
Jul 1 '08 #1
1 2307
acoder
16,027 Recognized Expert Moderator MVP
The ?: notation is short for if/else, so you would need something like:
Expand|Select|Wrap|Line Numbers
  1. slideTimeout = setTimeout(toggleSlideboxes, (isDown ? 3000 : 1000));
Jul 1 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
3920
by: libsfan01 | last post by:
hi i have a page which contains an visible nav down the left-hand side. when you click a button it needs to appear. i thought it would be cool to use scriptaculous to make it slide down. can anyone give me an example code for this? thanks marc
7
2846
by: nolo contendere | last post by:
the alert message appears before the Effect.SlideUp even begins. How can I ensure that the SlideUp completes before executing the next statement? I've tried setTimeout, and I can kind of get it to work, but that seems very kludgy, and may not work in all cases. TIA ===================== function add_entry( id ) {
83
4120
by: liketofindoutwhy | last post by:
I am learning more and more Prototype and Script.aculo.us and got the Bungee book... and wonder if I should get some books on jQuery (jQuery in Action, and Learning jQuery) and start learning about it too? Once I saw a website comparing Prototype to Java and jQuery to Ruby... but now that I read more and more about Prototype, it is said...
3
2397
by: NetWave | last post by:
Hi, For my next project I'm going to need Ajax, so I'm in about to read some books on ASP.NET Ajax. While reading Rick Strahl's blog I stumbled upon jQuery. I've been to the website and seen some examples, and it sure looks promising. However, I'm not sure how it relates to ASP.NET Ajax. Do they complement each other? Or are they...
26
3109
by: RobG | last post by:
Do some of the regulars here need to re-think their (sometimes strident) opposition to libraries? Both Microsoft and Nokia have announced support for jQuery. It seems to have gained quite a bit of momentum, can it be considered a reasonable choice for those who want to use a full-featured, well supported library? <URL:...
2
4544
by: souporpower | last post by:
Hi All I am trying to print some HTML using JQUERY. I am posting the code. I don't see the alert. It seems as though the function is not registered when the document is loaded. Can someone please clarify what I am doing wrong? BTW, I am using IE8 and Chrome to test. Sorry I can't place the code in a web site. Thanks for your help
53
8330
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script language="javascript" type="text/javascript">
3
5878
omerbutt
by: omerbutt | last post by:
hi there i am trying to run the lightbox and a slider on a single page the light box is working allrigh but when i try to include the slider in the same page it generates error because i have to include the jquery.js file to run it .i think it is a problem with the order of the file include. the error which i receive is here and on the...
3
4020
by: jmeyer5csc | last post by:
i am using jquery to display a working... div to show the user that the query is doing something. to show.... Sys.Application.add_init(function() { $addHandler($get('ctl00_ContentPlaceHolder1_LinkButtonQuickReport'), 'click', function() { $('#working').show(); }); }); to hide...
0
7467
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7401
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7807
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7756
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5326
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4944
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1879
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.