Search Results

Search found 951 results on 39 pages for 'toggle'.

Page 1/39 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Toggle Blind Effect

    - by flipflopmedia
    Is there a way to alter this script to be used as the blind effect. // Andy Langton's show/hide/mini-accordion - updated 23/11/2009 // Latest version @ http://andylangton.co.uk/jquery-show-hide // this tells jquery to run the function below once the DOM is ready $(document).ready(function() { // choose text for the show/hide link - can contain HTML (e.g. an image) var showText=''; var hideText=''; // initialise the visibility check var is_visible = false; // append show/hide links to the element directly preceding the element with a class of "toggle" $('.toggle').prev().append(' '+showText+''); // hide all of the elements with a class of 'toggle' $('.toggle').hide(); // capture clicks on the toggle links $('a.toggleLink').click(function() { // switch visibility is_visible = !is_visible; // toggle the display - uncomment the next line for a basic "accordion" style //$('.toggle').hide();$('a.toggleLink').html(showText); $(this).parent().next('.toggle').toggle('slow'); // return false so any link destination is not followed return false; }); }); FYI- Where it says: var showText=''; var hideText=''; It was originally: var showText='Show'; var hideText='Hide'; I deleted the Show/Hide Text because I am applying the link to different areas of text. I like the Blind effect, vs. this Toggle effect, and need to know how to apply it, if possible. I cannot find a basic Blind effect script that allows the use of applying the link to ANY text, vs. a button or static text. Thanks! Hope you can help! Tracy

    Read the article

  • jQuery UI split button toggle - toggle both parts of the button

    - by the berserker
    I would like to implement a toggle splitbutton with jQuery UI that would on toggle action change the style of the "dropdown" part as well (as seen in http://jsfiddle.net/8khz2/3/ - I'd like to appear it on 1st click as white, same as "Toggle" button does). Does anyone see a way to achieve that out of the box or only with CSS, without additional javascript code? Somehow I don't see an option doing it only with CSS, since I can not nest the "dropdown" button in "Toggle", since toggle part is checkbox: <input type="checkbox" id="toggle"/><label for="toggle">Toggle</label> <button id="select">Select an action</button> The jsfiddle example is based on: http://jqueryui.com/button/#splitbutton

    Read the article

  • jQuery Toggle Cookie Support

    - by hell0w0rld
    I'm trying to implement the jQuery Cookie plugin into my slide toggle script, but so far haven't been successful. Here's my code (without any cookie implementation): jQuery: $(document).ready(function() { $('a.toggle').click(function() { var id = $(this).attr('name'); $('#module' + id).slideToggle('fast'); $('a.toggle[name='+id+']').toggle(); return false; }); }); HTML: <a class="toggle" name="1" href="#">- Hide</a> <a class="toggle hidden" name="1" href="#">+ Show</a> <div id="module1"><p>Hello World</p></div> Anyone know if it's easy enough to implement the jQuery Cookie plugin into my existing code so it remembers the open/closed state? Thank you.

    Read the article

  • jQuery toggle caching / cookies

    - by user1706680
    I’m using the jQuery toggle function for my navigation. By default the Authors toggle is visible, the Archives toggle is closed. http://jsfiddle.net/TeDFs/4/ My problem is that when the users switches to another page the toggles reset themselves. For example, when the user closes the Authors toggle and opens the Archive toggle and then navigates to another page the default settings are loaded. I read that it’s possible to store the settings via cookies but I’m absolutely new to jQuery and it would be great if somebody could help me out! HTML <div id="authors" class="widget"> <h2 class="widget-title-visible">Authors</h2> <div class="toggle"> <div class="submenu"> <ul> <li>Name 1</li> <li>Name 2</li> <li>Name 3</li> <li>Name 3</li> </ul> </div> </div> <div id="archives" class="widget"> <h2 class="widget-title">Archiv</h2> <div class="toggle hidden"> <div class="submenu"> <ul> <li>November 2012</li> <li>Oktober 2012</li> </ul> </div> </div> </div>? jQuery function toggleWidgets() { jQuery('.widget-title').addClass('plus'); jQuery('.widget-title-visible').addClass('minus'); jQuery('.widget-title').click(function() { $(this).toggleClass('plus').toggleClass('minus').next().toggle(180); }); jQuery('.widget-title-visible').click(function() { $(this).toggleClass('minus').toggleClass('plus').next().toggle(180); }); } jQuery(document).ready(function() { toggleWidgets(); } )? CSS .hidden{ display:none; } .plus { background: url(http://moargh.de/daten/sidebar_arrows.png) 0 5px no-repeat; padding: 0 0 0 12px; } .minus { background: url(http://moargh.de/daten/sidebar_arrows.png) 0 -10px no-repeat; padding: 0 0 0 12px; }

    Read the article

  • Usefulness of Toggle functions

    - by roygbiv
    Is it better to write functions that explicitly do something (i.e. HideForm/ShowForm etc...) or is it better to write 'Toggle' type functions (i.e. ToggleVisibility)? I find Toggle type functions awkard because it's hard to track the state by reading the code. In what situations is a toggle type function useful?

    Read the article

  • .toggle(true) losing .css (font mismatch)?

    - by James123
    I am losing .css (font mismatch when .toggle(true). How to get back my right .css? $(document).ready(function() { $('tr[@class^=RegText]').hide().children('td'); list_Visible_Ids = []; var idsString, idsArray; idsString = $('#myVisibleRows').val(); idsArray = idsString.split(','); $.each(idsArray, function() { if (this != "") { $('#' + this).siblings('.RegText').toggle(true); list_Visible_Ids[this] = 1; } }); Losing font: $('#' + this).siblings('.RegText').toggle(true); .css working fine if I use below code: $('#' + this).siblings('.RegText').toggle(); But I want expand those sections by setting 'true'. How can I get back my font?

    Read the article

  • I need to unset the state of the jQuery .toggle(odd,even)

    - by Forkrul Assail
    Hi I have items in a table cell that gets toggled on and off. An external button accepts a click and submits the selected cell values via ajax. The problem is that I want to reset the toggle state for the selected cells. I can easily unset the highlighting, but then need a double click to trigger the correct toggle. Can the .toggle(odd, even) be reset or cycled via an external call? Thanks

    Read the article

  • Jquery toggle function that doesn't return false?

    - by Tom
    Hi, Is it possible to stop the automatic preventDefault() from applying in a simple Jquery toggle function? $(".mydiv").toggle( function () { $(this).addClass("blue"); }, function () { $(this).removeClass("blue"); } ); The above prevents elements inside the div from responding normally to the click. It doesn't have to be the toggle() function - anything that allows toggling a class on and off AND doesn't return false would be great. Thanks.

    Read the article

  • Jquery toggle with two elements

    - by Jesse
    I am using a toggle on a graphic to slide out a contact form. The problem is, the contact form can cover up the graphic element on low resolutions. I thought a solution would be to include a "close this" inside the form, that would use the same toggle effect. When I add the close this element to the code, instead of working in tandem with the original graphic element, it starts the chain back over, and slides the contact form even further out. Site is here: http://www.tritonloyaltysupport.com/status Code for toggle here: $(this).html(div_form); //show / hide function $('div.contactable').toggle( function() { $('#overlay').css({display: 'block'}); $('#contactForm').animate({"marginRight": "-=0px"}, "fast"); $('#contactForm').animate({"marginRight": "+=390px"}, "slow"); }, function() { $('#contactForm').animate({"marginRight": "-=390px"}, "slow"); $('#overlay').css({display: 'none'}); } );

    Read the article

  • jquery: Toggle elements based on result from a function

    - by Svish
    I have a number of table rows that I would like to toggle the visibility of. They should be visible if a data item I have set on them earlier equals a selected value in a form. This is what I have so far: $('#category-selector').change(function(event) { var category_id = $(this).val(); if(!category_id) { $('tr', '#table tbody').show(); } else { $('tr', '#table tbody').toggle(); } }); Of course this just toggles them on and off. Thing is that I thought I was able to give toggle a function that would decide if each row should be on or off, but it turns out I can only give it a boolean condition which would be an all or nothing deal kind of... So, I have this function: function() { return $(this).data('category_id') == category_id; } How can I use that to go through all the rows and toggle them on or off? Or is there a better approach to this? What should I do?

    Read the article

  • Jquery toggle using 2 elements

    - by user801773
    this is my script, I'm using a toggle so I can animate a sliding menu. $("div.show-menu").click().toggle( function() { // first alternation $("#slideover").animate({ right: "512px" }, 300); $(".menu-button").html('close menu'); }, function() { // second alternation $("#slideover").animate({ right: "0" }, 300); $(".menu-button").html('open menu'); }); Though I really need the toggle to work using 2 elements on the page. For example see below... <div class="show-menu one">open menu</div> // this is element one <div class="show-menu two">open menu</div> // this is element two I need it so, if element one get's click first, you can close the menu using element two on the first click. What is happening now is that you have to click element two twice in order for it to close the menu - vice versa I guess this is the toggle coming into play, any help would be great thanks. Cheers Josh

    Read the article

  • jquery toggle, prevent clicking during toggle

    - by Stacey
    Given the following jquery code.. $('#toggle').toggle(function() { // perform something }, function() { // perform something else }); Is there any way to prevent the toggle from being fired again if someone clicks while it is performing the function? I referenced http://stackoverflow.com/questions/2489518/tell-jquery-to-ignore-clicks-during-an-animation-sequence and the technique did not work.

    Read the article

  • jQuery: How to select the next element with name-xyz?

    - by Shpigford
    I'm trying to build a really simple generic toggle functionality where the toggling "switch" has a class of .toggle and then I want it to toggle() the next element that has the class .toggle-content. Example HTML: <p> <a href="#" class="toggle">Toggle the thing</a> </p> <p class="toggle-content hidden">I'm totally hidden right now</p> So right now I'd toggle that with: $(".toggle").click(function() { $(this).parent().next('.toggle-content').toggle(); }); The problem is if the .toggle class is any deeper in the DOM, I have to keep tacking on more parent()'s depending on how deep it is/isn't. So how can I just select the next instance of .toggle-content without having use a bunch of parent()'s and next()'s?

    Read the article

  • link_to_function toggle problem - Ruby on Rails

    - by bgadoci
    I asked this question back in November and everything seemed to work just fine. I am recently trying to implement it again and running into a problem. I am not receiving any error message, just can't get the toggle to work. Using Rails 2.3.5 and Ruby 1.8.7. See anything wrong here? View <%= javascript_include_tag :defaults %> <div id="comment-toggle"> <%= link_to_function "toggle", "$('comments_#{project.id}').toggle()" %> </div> <div id="comments_<%= project.id %>" class="comments" > <%= render :partial => project.comments %> <% remote_form_for [project, Comment.new] do |f| %> <p> <%= f.label :body, "New Comment" %><br/> <%= f.text_area (:body, :class => "textarea") %> </p> <p> <%= f.label :name, "Name" %> (Required)<br/> <%= f.text_field (:name, :class => "textfield") %> </p> <p> <%= f.label :email, "Email" %> (Required but will not be displayed)<br/> <%= f.text_field (:email, :class => "textfield") %> </p> <p><%= f.submit "Add Comment" %></p> <% end %> </div>

    Read the article

  • jquery toggle on hover for multiple divs

    - by Oterox
    I have some divs with identical structure and i want to toggle when the mouse hovers the div so a hides and b shows: <ul class="tweets"> <li> <div class="a"> <p>show a</p> </div> <div class="b"> <p>show b</p> </div> </li> <li> <div class="a"> <p>show a</p> </div> <div class="b"> <p>show b</p> </div> </li> <li> <div class="a"> <p>show a</p> </div> <div class="b"> <p>show b</p> </div> </li> </ul> This is the jquery i'm using: $(document).ready(function(){ var tweet = $("ul.tweets .a"); tweet.hover(function(){ $('.a').toggle(); $('.b').toggle(); }); }); But this toggles ALL the divs and i only need to toggle one.I should use $(this) but i don't know how.How could i make this work? The fiddle is here

    Read the article

  • Toggle two divs and classes

    - by kuswantin
    I have two links with classes (login-form and register-form) relevant to their target forms ID, they want to toggle. I have also a predefined 'slideToggle' function to toggle better. This is what I have tried so far: $('#userbar a').click(function() { var c = $(this).attr('class'); $('#userbar a').removeClass('active'); $(this).toggleClass('active'); $('#register-form,#login-form').hide(); //bad, causing flashy $('#' + c).slideToggle('slow'); return false; }); With this I have trouble with the flashy window, and to correctly toggle the active classes when another link is clicked, the other link should not have active class anymore. Additional problem is the link is dead on serial clicks. I have another try, longer one: $('#userbar a').click(function() { var c = $(this).attr('class'); switch (c) { case 'login-form': $('#' + c).slideToggle('slow'); $(this).toggleClass('active'); $('#register-form').hide(); break; case 'register-form': $('#' + c).slideToggle('slow'); $(this).toggleClass('active'); $('#login-form').hide(); break; } return false; }); This one is worse than the first :( Any suggestion to correct the behavior? What I want is when a link with class login-form is click, so toggle the form with ID login-form, and hide the register-form if open. Any help would be very much appreciated. Thanks.

    Read the article

  • jQuery Toggle with Cookie

    - by Cameron
    I have the following toggle system, but I want it to remember what was open/closed using the jQuery cookie plugin. So for example if I open a toggle and then navigate away from the page, when I come back it should be still open. This is code I have so far, but it's becoming rather confusing, some help would be much appreciated thanks. jQuery.cookie = function (name, value, options) { if (typeof value != 'undefined') { options = options || {}; if (value === null) { value = ''; options = $.extend({}, options); options.expires = -1; } var expires = ''; if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { var date; if (typeof options.expires == 'number') { date = new Date(); date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); } else { date = options.expires; } expires = '; expires=' + date.toUTCString(); } var path = options.path ? '; path=' + (options.path) : ''; var domain = options.domain ? '; domain=' + (options.domain) : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); } else { var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } }; // var showTop = $.cookie('showTop'); if ($.cookie('showTop') == 'collapsed') { $(".toggle_container").hide(); $(".trigger").toggle(function () { $(this).addClass("active"); }, function () { $(this).removeClass("active"); }); $(".trigger").click(function () { $(this).next(".toggle_container").slideToggle("slow,"); }); } else { $(".toggle_container").show(); $(".trigger").toggle(function () { $(this).addClass("active"); }, function () { $(this).removeClass("active"); }); $(".trigger").click(function () { $(this).next(".toggle_container").slideToggle("slow,"); }); }; $(".trigger").click(function () { if ($(".toggle_container").is(":hidden")) { $(this).next(".toggle_container").slideToggle("slow,"); $.cookie('showTop', 'expanded'); } else { $(this).next(".toggle_container").slideToggle("slow,"); $.cookie('showTop', 'collapsed'); } return false; }); and this is a snippet of the HTML it works with: <li> <label for="small"><input type="checkbox" id="small" /> Small</label> <a class="trigger" href="#">Toggle</a> <div class="toggle_container"> <p class="funding"><strong>Funding</strong></p> <ul class="childs"> <li class="child"> <label for="fully-funded1"><input type="checkbox" id="fully-funded1" /> Fully Funded</label> <a class="trigger" href="#">Toggle</a> <div class="toggle_container"> <p class="days"><strong>Days</strong></p> <ul class="days clearfix"> <li><label for="1pre16">Pre 16</label> <input type="text" id="1pre16" /></li> <li><label for="2post16">Post 16</label> <input type="text" id="2post16" /></li> <li><label for="3teacher">Teacher</label> <input type="text" id="3teacher" /></li> </ul> </div> </li>

    Read the article

  • jQuery Toggle with multiple unique DIVs?

    - by tony noriega
    I am using jQuery toggle with a link and a div. I will eventually have approx. 50 divs i want to toggle, and instead of creating a new function for each one, is there a way i can create a class and have it read unique ID's for each div? (if that makes sense) For instance, i will have A1, A2, A3, B1, B2, B3..e.tc.. $(document).ready(function() { $('#slickbox').hide(); $('a#slick-toggleA1').click(function() { $('#A1').toggle(300); return false; }); });

    Read the article

  • Toggle problem pls help me

    - by John the horn
    Hy I am a uber nube to jquery my question is like this: if I have multiple toggle on same page and the div I`m toggleing must be desplayed in the same div. For example I have in div 'box' 6 divs named '1' '2' '3' '4' etc and all are hiden if I click on a 'a' tag named 1 it will display content div 1 in div 'box' if I click tag 'a' named 2 will display content div 2 in box and hide div 1 etc. My problem is that I havent been able to hide div 1 if div 2 is show This is my code $(document).ready(function(){ $('#content1').hide(); $('#content').hide(); $('a.aici').click(function(){ $('#content1').toggle('slow'); }); $('a.acolo').click(function(){ $('#content').toggle('slow'); }); }); I need an if function to hide all except the div that is shown Thx for your time

    Read the article

  • jQuery - toggle the class of a parent element?

    - by Nike
    Hello, again. I have a few list elements, like this: <li class="item"> <a class="toggle"><h4>ämne<small>2010-04-17 kl 12:54 by <u>nike1</u></small></h4></a> <div class="meddel"> <span> <img style="max-width: 70%; min-height: 70%;" src="profile-images/nike1.jpg" alt="" /> <a href="account.php?usr=47">nike1</a> </span> <p>text</p> <span style="clear: both; display: block;"></span> </div> </li> <li class="item odd"> <a class="toggle"><h4>test<small>2010-04-17 kl 15:01 by <u>nike1</u></small></h4></a> <div class="meddel"> <span> <img style="max-width: 70%; min-height: 70%;" src="profile-images/nike1.jpg" alt="" /> <a href="account.php?usr=47">nike1</a> </span> <p>test meddelande :) [a]http://youtube.com[/a]</p> <span style="clear: both; display: block;"></span> </div> </li> And i'm trying to figure out how to make it so that when you click a link with the class .toggle, the parent element (the li element) will toggle the class .current. I'm not sure if the following code is correct or not, but it's not working. $(this).parent('.item').toggleClass('.current', addOrRemove); Even if i remove "('.item')", it doesn't seem to make any difference. So, any ideas? Thanks in advance, -Nike

    Read the article

  • jquery show/hide integrated with toggle/accordion effect

    - by mark
    I have a show/hide toggle working well in multiple instances (thanks to help here - search for 'jquery toggle to work in multiple instances'). I want to integrate it into an expanding menu / accordion style for the main categories. I have a script and it works on its own but I can't get it to work integrated with the show/hide. Any help greatly appreciated. The working show/hide: http://pastebin.me/c69869d7a80fdb439ca16304b821c146 the expanding menu script I want to integrate: http://pastebin.me/03b685f586fef84193b5fd72e815255d

    Read the article

  • JQuery Toggle Button Trigger

    - by Ozzy
    Hi all, i have this code: $('.access a').toggle(function() { $('link').attr('href', 'styles/accessstyles.css'); $('body').css('font-size', '16px'); }, function() { $('link').attr('href', 'styles/styles.css'); $('body').css('font-size', text_sizes[text_current_size] + 'px'); }); It works fine. But how would i programmatically trigger the toggle instead of clicking on it?

    Read the article

  • Jquery Toggle & passing data

    - by Ross
    I have created a toggle button with jquery but I need to pass my $id so it can execute the mysql in toggle_visibility.php. how do I pass my variable from my tag ? Yes $("a.toggleVisibility").toggle( function () { $(this).html("No"); }, function () { $.ajax({ type: "POST", url: "toggle_visibility.php", data: "id", success: function(msg){ alert( "Data Saved: " + msg ); } }); $(this).html("Yes"); } );

    Read the article

  • Jquery toggle functions

    - by ozsenegal
    I've a code to sort table using Jquery.I use toggle function to alternate clicks,and toggle beetween 'ascend' and 'descend' sort.Once you click header's table it should sort it contents. However,there's a bug: I click once,it sorts,then when i click again,nothing happens.I need to click again (second time) to execute the second function,and sort again. Toggle should switch functions with single clicks,not double,am i right? Here is the code: firstRow.toggle(function() { $(this).find("th:first").removeClass("ascendFirst").addClass("descendFirst"); $(this).find("th:not(first)").removeClass("ascend").addClass("descend"); sorted = $.makeArray($("td:eq(0)", "tr")).sort().reverse(); sorted2 = $.makeArray($("td:eq(1)", "tr")).sort().reverse(); sorted3 = $.makeArray($("td:eq(2)", "tr")).sort().reverse(); for (var i = 0; i < sorted.length; i++) { $("td", "tr:eq(" + (i + 1) + ")").remove(); $("tr:eq(" + (i + 1) + ")").append($("<td></td>").text($(sorted[i]).text())); $("tr:eq(" + (i + 1) + ")").append($("<td></td>").text($(sorted2[i]).text())); $("tr:eq(" + (i + 1) + ")").append($("<td></td>").text($(sorted3[i]).text())); } }, function() { $(this).find("th:first").removeClass("descendFirst").addClass("ascendFirst"); $(this).find("th:not(first)").removeClass("descend").addClass("ascend"); sorted = $.makeArray($("td:eq(0)", "tr")).sort(); sorted2 = $.makeArray($("td:eq(1)", "tr")).sort(); sorted3 = $.makeArray($("td:eq(2)", "tr")).sort(); for (var i = 0; i < sorted.length; i++) { $("td", "tr:eq(" + (i + 1) + ")").remove(); $("tr:eq(" + (i + 1) + ")").append($("<td></td>").text($(sorted[i]).text())); $("tr:eq(" + (i + 1) + ")").append($("<td></td>").text($(sorted2[i]).text())); $("tr:eq(" + (i + 1) + ")").append($("<td></td>").text($(sorted3[i]).text())); } });

    Read the article

  • Jquery load into div on toggle

    - by russp
    Not sure if this is possible but can you load and unload into a div on a jquery toggle? something a bit like this? $("#IDOFCLICK").live('click',function(){ $(this).toggleClass("active").('#IDOFDIVTOLOAD').load('PAAGETOLOAD').slideToggle("slow"); }); if you can I guess the above is not right, but, how would you also unload on the "reverse" toggle?

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >