Questions tagged [toggle]

To toggle a boolean variable is to switch it to its opposite state. If it is on, switch it off; if it is off, switch it on. In a desktop or web user interface, a toggle may be clickable switch or button that alternates the state of something in the application.

To toggle a boolean variable is to switch it to its opposite state. If it is on, switch it off; if it is off, switch it on. In a desktop or web user interface, a toggle may be clickable switch or button that alternates the state of something in the application.

5926 questions
18
votes
8 answers

How to toggle an int / _Bool in C

Suppose we have an int and want to toggle it between 0 and 1 in a boolean fashion. I thought of the following possibilities: int value = 0; // May as well be 1 value = value == 0 ? 1 : 0; value = (value + 1) % 2; value = !value; // I was curious if…
riha
  • 2,270
  • 1
  • 23
  • 40
17
votes
7 answers

Navbar toggle not working with Angular 4 / ng-bootstrap

I am using ng-bootstrap in my angular 4 project:
17
votes
2 answers

How can I create an Accordion List within ionic 2?

I want to integrate an accordion in my project using expandable groups but for a recent project, I was needing a rendition of an accordion that expanded text or more precisely overflowed content. Can you tell me how it will done within ionic 2 ?
Mahmoud Ismail
  • 1,617
  • 4
  • 27
  • 51
17
votes
3 answers

jQuery toggle and IF visible

I have a div which contains settings and options on an account management page. $("#moreOptions").slideToggle('slow'); if ($("#moreOptions").is(":visible") == true) { $("#lnkMoreOpt").text("Less Options «") } else { …
j82374823749
  • 847
  • 4
  • 15
  • 24
16
votes
6 answers

jQuery Toggle State

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…
neezer
  • 19,720
  • 33
  • 121
  • 220
15
votes
5 answers

Sliding divs horizontally with JQuery

so I'm very new to Javascript and Jquery. What I'd like to create is a two column page where links on the left column will cause a div on the right to slide in horizontally from left to right, and slide out of view when clicked again. I know I need…
Bridget Kilgallon
  • 325
  • 2
  • 3
  • 9
15
votes
2 answers

Dojo Toggle Hide and Show Divs

I've done some searching and come up with a lot of mixed results for using Dojo to toggle divs showing vs hidden. Some use dojo.style which it looks like might have been replaced by dojo.fx Some use dijit but thus cannot access a DOM node. Some…
ZMorek
  • 679
  • 1
  • 8
  • 24
15
votes
7 answers

collapse fieldset when legend element clicked

I have a jQuery function which toggles the visibility of the contents of a fieldset when its legend is clicked, leaving just the fieldset border (if there is one) and the legend showing: $('legend.togvis').click(function() { …
dnagirl
  • 20,196
  • 13
  • 80
  • 123
15
votes
3 answers

Angularjs toggle div visibility

I am trying to toggle a div text on click of a button. I tried taking a scope variable and toggeling classname based on the variable. Where am I making the mistake here
hello…
Kurkula
  • 6,386
  • 27
  • 127
  • 202
15
votes
7 answers

How can I place text inside an ion-toggle

Current I have a ion-toggle that looks like this I want to do this Is there anyway to make this happen? I read somewhere I could use ng-true-value and ng-false-value but that doesnt seem to do what I am looking for
esastincy
  • 1,607
  • 8
  • 28
  • 38
15
votes
6 answers

jquery toggle and fade in one function?

I was wondering if toggle() and fadeIn() could be used in one function... i got this to work, but it only fades in after the second click... not on first click of the toggle. $(document).ready(function() { $('#business-blue').hide(); …
tony noriega
  • 7,523
  • 17
  • 53
  • 72
15
votes
3 answers

jQuery: move window viewport to show freshly toggled element

I have a snippet of jQuery in doc ready which toggles a div containing a textarea: $('div#addnote-area').hide(); // hide the div $('a#addnote-link').click(function() { // click event listener on link $('div#addnote-area').toggle(); // toggle…
k00k
  • 17,314
  • 13
  • 59
  • 86
15
votes
8 answers

How to toggle (hide/show) a table onClick of tag in Javascript

I want to show and hide (toggle) the onClick event of the . this is my tag Login Here is my Javascript function toggleTable(hide):