trentrichardson / jQuery-Timepicker-Addon

Adds a timepicker to jQueryUI Datepicker
http://trentrichardson.com/examples/timepicker/
MIT License
2.66k stars 1.05k forks source link

Opacity of Now button #895

Open jeffreymergler opened 8 years ago

jeffreymergler commented 8 years ago

The Now button on the timepicker has its opacity set to 0.7 in css class="ui-priority-secondary". Was there a specific reason behind the opacity being set <1 ?

jseashell commented 6 years ago

@jeffreymergler Did you ever find a way around this? Running into the same issue myself. I would like the opacity to always be 1, but in order to do so I've done the following, which feels very hacky:

// Remove the "ui-priority-secondary" class when the text input for the picker is clicked.
$("input.hasDatepicker:text").click(function () {
    $nowButton = $(":button.ui-datepicker-current");
    $nowButton.removeClass("ui-priority-secondary");
    $nowButton.css("font-weight", "bold");

    // The Now button will also reset itself to have the "ui-priority-secondary" class 
    // when it gets clicked. 
    $nowButton.click(function () {
        $nowButton = $(":button.ui-datepicker-current");
        $nowButton.removeClass("ui-priority-secondary");
        $nowButton.css("font-weight", "bold");
    });

    // The Now button will also reset itself when a calendar day is clicked, 
    // but I couldn't get the selectors right to fix that one
});
jeffreymergler commented 6 years ago

I did a hack as well. I tie into the beforeShow handler and call this:

setTimeout('$("button.ui-priority-secondary").removeClass("ui-priority-secondary").addClass("ui-priority-primary");', 100);

I yank the secondary class and add in primary. I could have changed the opacity property to 1 instead but this seemed sensible and very easy.

Note: I use setTimeout because I need a short delay to make it work. I didn't spend a lot of time figurng out why but I think it has to do with the fact that my datetimepicker is being wired up in ASP.NET on the serverside and spewed to the client and then beforeShow is invoked on click of the alternative image.