I would like to add a subtle and quick fadeOut and FadeIn effect to a button change through switchClass.
j开发者_如何学PythonQuery("a#btnPause").switchClass(pauseClass,playClass,200);
The effect used by default is a slideLeft.
If I would use standard jQuery, I would like to put an effect on addClass and removeClass, but is that possible?
Is something like
$("a#btnPause").fadeOut(200).switchClass(pauseClass,playClass,200).fadeIn(200);
what you're looking for?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-1.8.16.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#btnDemo').click(function () {
$('a#btnPause').fadeOut(200).switchClass('pauseClass', 'playClass', 200).fadeIn(200);
});
});
</script>
<style type="text/css">
.pauseClass
{
color: Red;
}
.playClass
{
color: Green;
}
</style>
</head>
<body>
<a id="btnPause" class="pauseClass">Text</a>
<input type="button" id="btnDemo" value="Demo" />
</body>
</html>
精彩评论