toggle

Toggling an image src with jQuery

守給你的承諾、 提交于 2019-12-17 16:27:15
问题 I wrote some code to toggle the src of an image and also to pause/resume the jQuery cycle2 plugin. I'm not sure why it isn't working and would appreciate some help. $('.play-pause').click(function(){ if ($(this).attr('src', '/images/template/pause.png')) { $(this).attr('src', '/images/template/play.png'); $('.cycle-slideshow').cycle('pause'); } else if ($(this).attr('src', '/images/template/play.png')) { $(this).attr('src', '/images/template/pause.png'); $('.cycle-slideshow').cycle('resume');

jQuery Toggle Text?

佐手、 提交于 2019-12-17 15:12:10
问题 Does anybody know how to toggle text the html text of an anchor tag using jQuery. I want an anchor that when clicked the text alternates between "Show Background" & "Show Text" as well as fading in & out another div. This was my best guess: $(function() { $("#show-background").click(function () { $("#content-area").animate({opacity: 'toggle'}, 'slow'); }); $("#show-background").toggle(function (){ $(this).text("Show Background") .stop(); }, function(){ $(this).text("Show Text") .stop(); }); }

jQuery toggle animation

岁酱吖の 提交于 2019-12-17 10:42:54
问题 I have this jQuery: $(document).ready(function() { $("#panel").hide(); $('.login').toggle( function() { $('#panel').animate({ height: "150", padding:"20px 0", backgroundColor:'#000000', opacity:.8 }, 500); }, function() { $('#panel').animate({ height: "0", padding:"0px 0", opacity:.2 }, 500); }); }); This is working fine, but I need to extend the functionality a little. I want to also similarly manipulate another div's properties in sync with the #panel div. I tried adding two more functions

jQuery Toggle State

一曲冷凌霜 提交于 2019-12-17 10:42:17
问题 Here's the quick and skinny of my issue: $("a").toggle(function() { /*function A*/ }, function() { /*function B*/ }); Inside function A a form is displayed. If the user successfully completes the form, the form is hidden again (returning to it's original state). Inside function B the same form is hidden. The theory behind this is that the user can choose to display the form and fill it out, or they can click again and have the form go back into hiding. Now my question is this: currently, if

What is alternative to use after jQuery 1.9 removed .toggle(function,function)?

限于喜欢 提交于 2019-12-17 09:49:39
问题 Hi i'm trying to create something that will alternate shrinking and growing on every click, but i'm using jQuery 1.9 for my website. the .toggle(function,function) function was removed from jQuery 1.9 , so I'm not really sure what I should use instead. Any help would be great. Thanks jsfiddle (uses old code, the jquery 1.8 version): http://jsfiddle.net/TNAC6/ new jsfiddle (jquery 1.9): http://jsfiddle.net/TNAC6/1/ Here is my code I'm trying to make toggle. Basically the thing i'm toggling is

jQuery toggle CSS?

风流意气都作罢 提交于 2019-12-17 03:28:17
问题 I want to toggle between CSS so when a user clicks the button ( #user_button ) it shows the menu ( #user_options ) and changes the CSS, and when the user clicks it again it goes back to normal. So far this is all I have: $('#user_button').click( function() { $('#user_options').toggle(); $("#user_button").css({ borderBottomLeftRadius: '0px', borderBottomRightRadius: '0px' }); return false; }); Can anybody help? 回答1: For jQuery versions lower than 1.9 (see https://api.jquery.com/toggle-event):

Hide all next tr td until next tr th

梦想与她 提交于 2019-12-14 04:19:47
问题 it should be simple but this jQuery function are taking a element to much, it even hide the jQuery I think. What I will like to do, is when a person click a tr th , all next tr td should be hide until next tr th . How can I get this code to work?? <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <style> th { background:#dad; font-weight:bold; font-size:16px; width: 50%; } td { background:red; font-weight:bold; font-size:16px; width: 50%; } </style>

Javascript toggling element's display not working

浪尽此生 提交于 2019-12-14 04:08:33
问题 I've done this dozens of times, but for some reason I can't figure out why the #dropdown-list div isn't displaying when the #dropdown-button is clicked... <html> <head> <script type="text/javascript"> function toggleDropdown(optionalArg){ optionalArg = (typeof optionalArg == "undefined")?'defaultValue':optionalArg ele = document.getElementById("dropdown-list"); //If optionalArg is 0 we want to hide it if(optionalArg == 0){ ele.style.display=='none' } //If optionalArg is 1 we want to show it

Toggle two divs percentage width with one button

天大地大妈咪最大 提交于 2019-12-14 03:22:15
问题 i want to toggle the width of two divs with one button as seen on: http://www.ulrichshusen.de The menu on top shrinks while the left area is shown. And it expands while the left area isn't shown. How can i accomplish this with jquery? 回答1: $(document).ready(function(){ $('**button class here**').click(function(){ $('div to be resized').toggle(); $('div to be resized').toggle(); )}; }); Here is to add class and remove class $(document).ready(function(){ $('**button class here**').click

How do I remove class from previous selection when clicking additional item?

心不动则不痛 提交于 2019-12-14 03:17:18
问题 http://jsfiddle.net/freqn/ZHt6V/2/ How do I remove class from previous selection when clicking additonal item in this accordion? I want the class to be removed from the previous clicked item when the next item is expanded. All other items should turn back to gray when new item is selected. Thank you. (function () { $('dd').hide(); $('dt').click(function(){ $(this) .next() .slideToggle(200) .siblings('dd') .slideUp(200); }); $('dt').click(function(){ $(this).toggleClass('active'); }); })();