JQuery :: SlideToggle To Follow An Element In Motion?
Sep 19, 2010
I am trying to use slideToggle to drop down a hidden DIV.This hidden div is in the footer.As the div drops down, I would like that the window scrolls down with the div rather than just opening the div and forcing the user to then scroll down with their mouse.I tried setting the button to an element below the DIV as follows <a href="#element below hidden div"></a>And it works sorta, but not completely.
Recently I've been using a .slideToggle script to show big images when thumbnails are clicked.
However, the <div> that is revealed does not Toggle Up when multiple thumbs are clicked, so I'm left with a bunch of open <div>s on the page.
I'm not sure what to do -- I think it has something to do with the siblings of the class "largeexamples" but I'm not sure. I've also been reading about eq, but I'm not there yet.
I found this link on Dynamic Drive for an image slider but the client says that it has a jerky motion. Can anyone think of how to EASE this animation? I can see settings for speed but nothing for easing. code...
This script creates a motion blur effect of a moving object - Downgrades very well with others.
You must look at a sample to see what it is and how nice it is. All you need to do is put the code bellow in the body section of your page... Instructions are in the code to change properties...
Go to http://free.7host04.com/logocurve/index.html for the LogoCurve generator to view samples and work out what you need - It makes life a LOT easier!! :)
Hope you enjoy! David :thumbsup:
<script language="JavaScript"> <!--Hide /* LOGO CURVE Version 3.2 24.01.2003 Writen by David Bann - South Africa e-mail: david@ftgconsulting.co.za
Feel free to use this code, but please email me the website it is used on, and leave this commenting in tact. Thank you! Please let me know of any bugs or if you edit the script.
Additions since version 3.1: - Added chengeable formulas for curve. - Added changeable event at which the script is initiated.
Things to come: - Better use of layers - will use less layers, but still get same effect... (User will be able to specify how many layers to be used, adding more functionality and effects, as well as performance) - I want to add an option of document boundaries for the curve,as to stop the logo from going out of the document and dissapearing totaly. - Fade to work in browsers other then IE. */
//----------------------- Start Customizable Variables -----------------------// //=== Positioning ===// var left = 0;// Starting left position var top = 20;// Starting left position
//=== Curve and Distance ===// var topInc = 5;// Incriment of top position var leftInc = 5;// Incriment of left position
/* Make both the horizontal curve and the vertical curve the same to.. .. get an increasing gap with no curve. */ var hor_curve = 20;// Horizontal curve - 0 for no curve var ver_curve = -20;// Vertical curve - 0 for no curve
//=== Timing and Other ===// var noTimes = 50;// Number of times the picture is shown var waitTime = 1;// Time delay
var layer = 2;// Layer level var picture = 'smalllogo.gif'// Picture to display (Smaller images work better)
var start_retracted= true;// Start the image retracted (true / false) var retract= true;// Retract from behind after expanding (true / false)
//=== Fade options (Only IEusers see fade) ===// var fade = true;// Gradual Fade (true / false) - Only works if retract =true var fd_destop = 0;// Destination transparency level (ie 80, for mostly solid) var fd_rate = 10;// Time in milliseconds between trasparency changes (best under 100) var fd_delta = 5;// Amount of change each time (ie 5, for 5% change in transparency)
var event_init = 'onClick'// Event at which the script is initiated var left_formula = '(left + leftInc) + ((count/100) * hor_curve)'// Left position formula var top_formula = '(top + topInc) + ((count/100) * ver_curve)'// Top position formula //----------------------- End Customizable Variables -----------------------// //--------------------- DO NOT EDIT BEYOND THIS POINT! ---------------------//
var count = 0; var count2 = 0; var timeOutVal = waitTime * 10; var txt; var image; var imageName; var lay = new Array;
function addLayer(){ left = eval(left_formula); top = eval(top_formula);
function logoCurveInit(){ while (count < noTimes) { addLayer(); count++; } count = 0;
lay[0].showIt();
if (!start_retracted) animate(); }
function animate(){ if (start_retracted) { if (!retract){ if (count > 0){ setTimeout('animate()',timeOutVal);
lay[count].hideIt();
count--; } } else{ if (count >= 0){ setTimeout('animate()',timeOutVal);
lay[count].showIt();
if (count != 0) fadeImage();
count--; } }
if (retract){ if(count==0) retractIt(); } } else{ if (count < noTimes){ setTimeout('animate()',timeOutVal);
lay[count].showIt();
if (count != noTimes-1 && retract) fadeImage();
count++; }
if (retract){ if (count == noTimes) retractIt();
} } }
function replay(){ if ((count == noTimes || (count == 0 || count == -1)) &&(count2 == noTimes-1 || count2 == 0)){ start_retracted = !start_retracted; // Make the value opposite of what it is
function retractIt(){ if (start_retracted) { // If the logo is not retracted (showing all the layers) if (count2 > 0){ setTimeout('retractIt()',timeOutVal); lay[count2].hideIt(); count2--; } } else{ // If the logo is retracted (Only showing the first layer) if (count2 < noTimes-1){ setTimeout('retractIt()',timeOutVal); lay[count2].hideIt(); count2++; } } }
function fadeImage(){ if (fade){ if (count >= 0 && count <= noTimes){ image = document.images['Image' + count]; nereidFade(image,fd_destop,fd_rate,fd_delta); } } }
function make_all_visible(){ for (var i = 0; i< noTimes ; i++){ if (document.images['Image' + i].style.MozOpacity){ document.images['Image' + i].style.MozOpacity=100; } else if (document.images['Image' + i].filters) { document.images['Image' + i].filters.alpha.opacity = 100; } } } ////***************(DHTMLCentral.com)****************//// function check_browser(){ this.ver=navigator.appVersion this.agent=navigator.userAgent this.dom=document.getElementById?1:0 this.opera5=this.agent.indexOf("Opera 5")>-1 this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0; this.ie4=(document.all && !this.dom && !this.opera5)?1:0; this.ie=this.ie4||this.ie5||this.ie6 this.mac=this.agent.indexOf("Mac")>-1 this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; this.ns4=(document.layers && !this.dom)?1:0; this.bw=(this.ie6||this.ie5||this.ie4||this.ns4||this.ns6||this.opera5) return this } bw=new check_browser() function show_message(txt){alert(txt); return false} function lib_obj(obj,nest){ if(!bw.bw) return show_message('Old browser') nest=(!nest) ? "":'document.'+nest+'.' this.evnt=bw.dom? document.getElementById(obj): bw.ie4?document.all[obj]:bw.ns4?eval(nest+"document.layers." +obj):0; if(!this.evnt) return show_message('The layer does not exist ('+obj+')' +'- If your using Netscape please check the nesting of your tags!') this.css=bw.dom||bw.ie4?this.evnt.style:this.evnt; this.ref=bw.dom||bw.ie4?document:this.css.document; this.x=parseInt(this.css.left)||this.css.pixelLeft||this.evnt.offsetLeft||0; this.y=parseInt(this.css.top)||this.css.pixelTop||this.evnt.offsetTop||0 this.w=this.evnt.offsetWidth||this.css.clip.width|| this.ref.width||this.css.pixelWidth||0; this.h=this.evnt.offsetHeight||this.css.clip.height|| this.ref.height||this.css.pixelHeight||0 this.c=0 if((bw.dom || bw.ie4) && this.css.clip) { this.c=this.css.clip; this.c=this.c.slice(5,this.c.length-1); this.c=this.c.split(' '); for(var i=0;i<4;i++){this.c[i]=parseInt(this.c[i])} } this.ct=this.css.clip.top||this.c[0]||0; this.cr=this.css.clip.right||this.c[1]||this.w||0 this.cb=this.css.clip.bottom||this.c[2]||this.h||0; this.cl=this.css.clip.left||this.c[3]||0 this.obj = obj + "Object"; eval(this.obj + "=this") return this } lib_obj.prototype.showIt = function(){this.css.visibility="visible"} lib_obj.prototype.hideIt = function(){this.css.visibility="hidden"} lib_obj.prototype.writeIt = function(text,startHTML,endHTML){ if(bw.ns4){ if(!startHTML){startHTML=""; endHTML=""} this.ref.open("text/html"); this.ref.write(startHTML+text+endHTML); this.ref.close() }else this.evnt.innerHTML=text } ////***************(DHTMLCentral.com)****************//// /* Code taken from DynamicDrive.com (Start)--> Gradual-Highlight Image Script II- By J. Mark Birenbaum (birenbau@ugrad.cs.ualberta.ca) For full source to script, visit http://dynamicdrive.com */ nereidFadeObjects = new Object();nereidFadeTimers = new Object(); function nereidFade(object, destOp, rate, delta){ if (!document.all)return if (object != "[object]"){ setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0); return;} clearTimeout(nereidFadeTimers[object.sourceIndex]); diff = destOp-object.filters.alpha.opacity; direction = 1; if (object.filters.alpha.opacity > destOp){direction = -1;} delta=Math.min(direction*diff,delta); object.filters.alpha.opacity+=direction*delta; if (object.filters.alpha.opacity != destOp){ nereidFadeObjects[object.sourceIndex]=object; nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate); } } // <-- Code taken from DynamicDrive.com (End) window.onload=new logoCurveInit(); //-->End Hide </script>
I'm having problems performing a simple load(...) request to bring in HTML content from a partner Oracle system within the same domain. Our portal has a built-in SO connection will handles security for me transparently. However during the process it initiates a 302 temporarily moved response which seems to trip up an AJAX request, but doesn't trip up Firefox when accessed through the address bar. If I use the same URL in an IFRAME it's totally fine.
After tons of googling, searching the forums, and the bug tracker database I cannot find anyone who has experienced this problem. Before I open a bug ticket I'd like community feedback to help me see if I am doing anything wrong.
My goal is to create a mouse action that makes an image follow the cursor, but ONLY when the cursor is above another element (in this case another image). If I just add "onMouseOver="cursorInit()" it works great to start the object once the cursor is over the second image, but how do I make the event die onMouseOut? I think I need another function, but I don't know how to kill these events. Code:
I need to execute a function after a link to a section within the same document has been clicked and the navigation has occurred. When using the onclick event handler the JS function is executed before the navigation occurs. I can't tie it to a window.onload event since the link only navigates within the already loaded document.
I'm not having any luck searching due to not knowing what keywords to use. I looked at an explanation of bubbling vs capturing, but that doesn't appear to be what I need.
I have a javascript code which makes a word toggle links under it. For example: Before clicking on it it looks like this: Stories: then once its clicked on it looks like: Stories: story 1 story 2 story 3
How can I make it so when you click stories it creates that list and also goes to story 1. Here is the code I have: Code: <h2 style="margin-left : 25px;"><img src="/images/sort_ASC.gif" id="img_DegreeList5" alt="" /> <a href="javascript:toggleDegreeList(5);" style="color:#336699;">Teaching Tales</a></a></h2> <div id="DegreeList5" style="display:none;"> <ul><ul> <li><a href="teaching_tales1.php">Story 1</a></li> <li><a href="teaching_tales2.php">Story 2</a></li> </ul></ul> </div>
And here is the toggledegree script Code: <script type="text/javascript"> var currentDegreeList = null; function toggleDegreeList(which) { if(currentDegreeList) { document.getElementById('DegreeList'+currentDegreeList).style.display = 'none'; document.getElementById('img_DegreeList'+currentDegreeList).src = '/images/sort_ASC.gif'; } if(currentDegreeList != which) { document.getElementById('DegreeList'+which).style.display = 'block'; document.getElementById('img_DegreeList'+which).src = '/images/sort_DESC.gif'; currentDegreeList = which; } else { currentDegreeList = null; } } var submitted = false; function submitForm() { var val = (submitted) ? false : true; submitted = true; return val; } </script>
If you actually want to see the live page its here [URL].
I wish to make onmouse over image following cursor! (it is not advertise, so i hope administrators will not banned my link, its just example what i wish!)
[url]
-It working even in IE6 without asking to allow JS!
Basically stumbleupon is a cool social bookmarkingesque site. And it has over 10million users. For this reason I would like to add the stumbleupon follow button on my site.What is itumbleupon.com/stumbler/stumbleuponou'll see there's a follow button on the top right hand corner. Now if you click on that not logged in, you'll be sent to a different page. If you're logged in however, you'll be subscribed to the user.Fellow JavaScripters, is it possible to implement the button onto a different site? If so, how?
I was wondering how and I tried creating a div that is a child of a div with its same width, but the length of the entire page.So in a way it is like a scroll-bar except the user can not move down the page by holding the smaller inner div (square). The small square just moves down its container as the mouse moves down to The bottom of the page.but since The square inner div is in a container, with the same with, it can not and will not be able to move horizontally.
Is there a way to tell the state of slideToggle? My problem is I have two buttons that change a div and also toggle it open/close. But if you click one button then click the other, the changes take effect and then it will close. So is there something like if(slideToggle() == open) or something along those lines?
i'm using slideToggle which reveals a large element upwards;
[URL]
Given that the element revealed is very high the anchor tag that is used to show/hide sometimes disappears. I've tried return false; but that doesn't fix it
I use two jQuery plugins in my page : slideToggle (for a top panel) and wslide (for showing two examples with images and captions).The problem is, the content of my wslide goes down and downer each time we open the toppanel. Is there any way of getting around this problem and make the content stick to where it should be? Here's some code :
I'm using a slideToggle() to show or hide a div in the bottom of my page.When the div is shown the view don't "follow" the div that is appearing.How can i make the view sliding down with the div that is appearing?
This works fine, except if you move your mouse over the child-element before the animation is complete.then it gets stuck in an endless bouncing up and down loop. Tried so many different possibilities with flagging the element while it was animating, stopping animations, adding delays and what not.
I am trying to make a form that collects "Number of Children" a parent has. If they select "4" from the select input, then I want to slidetoggle out the appropriate divs, one for each child.
[Code]...
I have been able to use slidetoggle in the past when attached to a button, but this one has me lost. Anyone know how to accomplish this?
For my work i need to make a form. At some points you have to choose an option from a dropdown select box. After you have chosen one of those some other field appear under the dropdown thing. I use the slideToggle event for this effect. In firefox its all working fine, but in ie 6.0 and 7.0 it doesnt work. What do need:A dropdown menu with a few options in it. You can choose one of those and after you select it a few other options apear under the dropdown menu.
I just included some Jquery on my portfolio page. Every project slide open and close when you click on it. [url]
But I just found out that it doesn't work in Firefox on my mac. It does in Safari (I can't test on windows).
I put everything in a <dl id=workcontent>, so the project names in a <dt> and the content in <dd>. I let Jquery look for the <dt> and if you click on it, it will slide open.
Just like in the tutorial on the jquery page. Also all the subheadings are missing, you can only see the first one (video), but there are more (animation, web, other).
Now where does the problem lie? Should I use all <a> links instead of <dt> ? And how can I let Jquery act the same way then as it does now?
I'm trying to piece together a little div which slides out and shows various links to sites like Digg, Reddit to share the story with. I've got it kind of working but when there are multiple divs on the page, named the same like in each article of a post on a Wordpress blog. Only the top ones work and the rest don't do anything...I'm trying to get it do something like the image => HereThis is an example I'm trying to get to work but the second "slickbox" div never shows
I am trying to get my divs to resize but i am having a number of difficulties. I am new to jQuery so be gentle! Here is what i am trying to achieve:
1) When the "About me" div is clicked - resize the "About Me" div and hide the other divs. (Which i have managed to get working)
2) When the initialanimation has finished, wait for another click before resizing the div to its original size/position. (This is working but I have had to use the delay function to "pause" the animation - which is not ideal).
I need to toggle my lists independently within my <sidebar> div. As current, it will minimize or maximize them all upon click. My aim is for them all minimized to begin with, and upon individual selection, i wish them to maximize. Heres what i currently have:
I'm using mouseenter and mouseleave to call a slideToggle on a dropdown menu. What's bothering me though is if my mouse moves in and out of the menu a few times before the toggle animation is complete and replays the open close a few times before stopping. [URL]... Is there a way to kill the queue so that it doesn't play if the mouse is not over it anymore?