gpt4 book ai didi

javascript - 如何在没有选择列表的情况下切换 jquery 盲效果(默认)

转载 作者:行者123 更新时间:2023-11-30 11:56:53 26 4
gpt4 key购买 nike

我想在单击按钮时显示对象,但不显示选择列表。这是code的链接.谢谢:)

最佳答案

你需要这样吗?

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Effects - Toggle Demo</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>

<style>
.toggler {
width: 500px;
height: 200px;
}
#button {
padding: .5em 1em;
text-decoration: none;
}
#effect {
position: relative;
width: 240px;
height: 135px;
padding: 0.4em;
}
#effect h3 {
margin: 0;
padding: 0.4em;
text-align: center;
}
</style>
<script>
$(function() {
// run the currently selected effect
function runEffect() {
// get effect type from
var selectedEffect = $( "#effectTypes" ).val();

// most effect types need no options passed by default
var options = {};
// some effects have required parameters
if ( selectedEffect === "scale" ) {
options = { percent: 0 };
} else if ( selectedEffect === "size" ) {
options = { to: { width: 200, height: 60 } };
}

// run the effect
$( "#effect" ).toggle( selectedEffect, options, 500 );
};
runEffect();
// set effect from select menu value
$( "#button" ).click(function() {
runEffect();
});
});
</script>
</head>
<body>

<div class="toggler">
<div id="effect" class="ui-widget-content ui-corner-all">
<h3 class="ui-widget-header ui-corner-all">Toggle</h3>
<p>
Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede. Nulla lorem metus, adipiscing ut, luctus sed, hendrerit vitae, mi.
</p>
</div>
</div>

<select name="effects" id="effectTypes" style="display:none;">
<option value="blind">Blind</option>
</select>

<button id="button" class="ui-state-default ui-corner-all">Run Effect</button>


</body>
</html>

关于javascript - 如何在没有选择列表的情况下切换 jquery 盲效果(默认),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37691301/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com