0

Change the "slow" parameter to the swing action

 2 years ago
source link: https://www.codesd.com/item/change-the-slow-parameter-to-the-swing-action.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Change the "slow" parameter to the swing action

advertisements

So here is a show/hide toggle button that works just fine. Here is the same exact code, except that I passed the 'slow' parameter to the .toggle action. Why does the button's value toggle correctly in the first example, but not the second? Does passing the 'slow' parameter to the .toggle action somehow cause the :visible pseudo-class to return true?


$('#toggleButton2').click(function () {
    $('#disclaimer').toggle('slow', function () {
        if ($('#disclaimer').is(':visible')) {
            alert('hide');
            $('#toggleButton2').val('Hide');
        } else {
            alert('Show');
            $('#toggleButton2').val('Show');
        }
    });
});

JS FIDDLE LINK

SAME BUT SHORT

$('#toggleButton2').click(function () {
    $('#disclaimer').toggle('slow', function () {
        $(this).is(':visible') ? $('#toggleButton2').val('Hide') : $('#toggleButton2').val('Show')

    });
});

JS FIDDLE LINK FOR SECOND ATTEMPT

Tags jquery

Related Articles

Change the form action according to the submit button

I have many forms like the following on the page. Now I want change the form action based on which submit button the user clicked (and of course submit the form) <form action="/shop/products.php" data-ajax="false" method="post&

Change the shape action parameter based on the value of the PHP array

I'm trying to create a form in PHP that, when submitted, the URL within action= is altered depending on the option selected. Code below: $myArray = array( '389'=>'Value 1', '533'=>'Value 2' ); echo'<form action="https://example.com/value.php

Change the form action on the drop-down selection

So I've got myself a form here shown below; I'm trying to change the form's action link based on the selection. However it's not really working for me. <form action=""> <select id="location"> <option value="http://w

Change the form action according to the selected item

I'm new to html, but I need to make this block of code functional: <form method="get" action="http://cat.opal-libraries.org/search~S9/X"> <p> <select name="searchtype"> <option value="X" selecte

cakephp changes the default action for the controller (that is, from & ldquo; index & rdquo;)

I have some controllers I want to default to table and not index, as they present better in a different format than my index pages use. How can I change this?Got it. For others: The file /app/config/routes.php contains the routing configuration, and

Change the JQuery action to the form based on the check box

Need to change the url a person goes to after submit based on checkbox in form. Currently using: $('form').submit(function(){ if ($('input[name=dance_inc_setup]').is(':checked')){ $('form').attr('action', 'checkout2'); } }); the form is at danceinc.o

How can I dynamically change the onClick action of an ImageView?

I have a ImageView that does an action called setAsFavorite(). This action sets a product as favorite, so I change the image of the ImageView. But when the product is favorite, I want to change the onclick event, so when the user presses the imageVie

Change the event action based on another event

Is there a generally accepted method to change the action of a JavaScript event? The following seems clean, but doesn't work as the first event is bound to #link when the page is rendered, and nothing changes when the class changes. Does it sound lik

how to change the form action url for contact form 7?

I'm using Contact Form 7 in a wordpress site with multiple forms. I need to direct one form to a different form action url than the others. I found the reply below for a previous thread but I'm not sure how to go about it. Can someone specify what ex

How do I change the filter action when there is no input?

I want to make a typeAhead in AngularJs, and following this tutorial I have made it most of the way. The only thing that it doesn't do for me is that I want the whole list to show up when you first click in the box, instead of it waiting for input to

Change the bright action button once it is clicked

I have the following in server.R shinyServer(function(input, output) { # builds a reactive expression that only invalidates # when the value of input$goButton becomes out of date # (i.e., when the button is pressed) ntext <- eventReactive(input$goBut

Change the default action in a SharePoint list

to a list, I added a custom action that shows in the drop-down menu on AllItems.aspx and points to a custom page. However, I want it to be the default action, so that clicking on the item doesn't go to DispForm.aspx Any tip? ThanksFrom your question

UI Changing the Swing application on platforms

My Swing Application's GUI is built using Window Builder Pro GUI editor. Layouts used are MigLayout and AbsoluteLayout. Application is developed using Windows Machine, So UI is well aligned and neat in Windows, but when I run the same application in

Changing the default action of the Zend based on the controller

So I know that you can set a custom default action in Zend Framework in the application.ini: resources.frontController.defaultAction = "something" But what if I want this default action to be contingent on the controller? So controller A's defau

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK