gpt4 book ai didi

javascript - 使用 Jquery 自定义按钮和 slider (大小、位置、标题大小)

转载 作者:行者123 更新时间:2023-11-28 11:59:56 25 4
gpt4 key购买 nike

我已经使用 c、php 和 javascript 为我的家庭自动化总线系统构建了一个网络界面。该功能运行良好,但我无法使用 JQuery 为我的按钮和 slider 实现正确的样式。

我想要做的是将按钮和 slider 放置在彼此相邻的“行”中,并能够调整它们的大小和样式,以便与常规 PC 浏览器和我的 iOS 设备一起使用。

  1. 按钮大小适用于我的所有设备,但从 iOS 设备查看时,更改部分的按钮字体大小不会影响字体大小。我通过在 html 正文中设置字体大小帮助自己解决了这个问题。这种行为有明显的原因吗?

  2. 谁能给我指出一个示例,其中有一个按钮与 slider 和一个显示 slider 值的数字字段。当然,我已经查看了标准的 Jquery slider 示例,但无论我尝试使用类来操纵样式的语法组合如何,我都没有得出我想要的大小、位置(内联)和标签的内联 slider 。

下面是我的代码作为引用。我玩过 Arduinos 和 C++ 的 Raspberry 编码,但显然我或多或少没有任何 html 或 javascript 经验,所以我非常感谢你的帮助!

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Wipperaller</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

<style>
body{background-color:white;}
button{
width: 180px;
height: 90px;
font-size: 50px;
padding-top: 5px;
padding-bottom: 5px;

};
myslider{
width: 1em;
height: 1em;
cursor: default;}

</style>

<script>
function handlerName(busCommand)
{
alert(busCommand.data.msg);
}

function SendBusCommand(inputData) {
$.ajax({
type: "POST",
url: "socketclient_01.php",
data: inputData.data,
cache: false,
success: function(html){
$("#results").append(html); // hier wird dann der inhalt,
// den deine datei ausgibt,
//in das element mit der id results eingetragen
}
});
}

$(document).ready(function(){
$("button").button();
$("#SZToggle").bind("click", {destination: "11130", com: 0x35, param1: 0x00, param2: 0x00}, SendBusCommand);
$("#SZAn").bind("click", {destination: "11130", com: 0x32, param1: 0x64, param2: 0x00}, SendBusCommand);
$("#SZAus").bind("click", {destination: "11130", com: 0x32, param1: 0x00, param2: 0x00}, SendBusCommand);
$("#SZKabuff").bind("click", {destination: "10206", com: 0x32, param1: 0x00, param2: 0x00}, SendBusCommand);
$("#WZToggle").bind("click", {destination: "10106", com: 0x35, param1: 0x00, param2: 0x00}, SendBusCommand);
$("#WZWToggle").bind("click", {destination: "10102", com: 0x35, param1: 0x00, param2: 0x00}, SendBusCommand);
$("#EZToggle").bind("click", {destination: "11030", com: 0x35, param1: 0x00, param2: 0x00}, SendBusCommand);
$("#EZAn").bind("click", {destination: "11030", com: 0x32, param1: 0x64, param2: 0x00}, SendBusCommand);
$("#EZAus").bind("click", {destination: "11030", com: 0x32, param1: 0x00, param2: 0x00}, SendBusCommand);
$("#EGAus").bind("click", {destination: "32872", com: 0x32, param1: 0x00, param2: 0x00}, SendBusCommand);
$("#OGAus").bind("click", {destination: "32882", com: 0x32, param1: 0x00, param2: 0x00}, SendBusCommand);
$("#AllesAus").bind("click", {destination: "32868", com: 0x32, param1: 0x00, param2: 0x00}, SendBusCommand);
$("#KuToggle").bind("click", {destination: "10104", com: 0x35, param1: 0x00, param2: 0x00}, SendBusCommand);
$("#AUELicht").bind("click", {destination: "10403", com: 0x35, param1: 0x00, param2: 0x00}, SendBusCommand);
$("#AUTLicht").bind("click", {destination: "10404", com: 0x35, param1: 0x00, param2: 0x00}, SendBusCommand);
$("#AUSteck").bind("click", {destination: "10405", com: 0x35, param1: 0x00, param2: 0x00}, SendBusCommand);
$("#BADSLicht").bind("click", {destination: "10205", com: 0x35, param1: 0x00, param2: 0x00}, SendBusCommand);
$("#BADDLicht").bind("click", {destination: "10302", com: 0x35, param1: 0x00, param2: 0x00}, SendBusCommand);
$("#AlleAuf").bind("click", {destination: "32968", com: 0x32, param1: 0x64, param2: 0x00}, SendBusCommand);
$("#AlleZu").bind("click", {destination: "32968", com: 0x32, param1: 0x00, param2: 0x00}, SendBusCommand);
$("#EGAuf").bind("click", {destination: "32970", com: 0x32, param1: 0x64, param2: 0x00}, SendBusCommand);
$("#EGZu").bind("click", {destination: "32970", com: 0x32, param1: 0x00, param2: 0x00}, SendBusCommand);
$("#EGAuf").bind("click", {destination: "32972", com: 0x32, param1: 0x64, param2: 0x00}, SendBusCommand);
$("#EGZu").bind("click", {destination: "32972", com: 0x32, param1: 0x00, param2: 0x00}, SendBusCommand);
$("#WZJalFrontAuf").bind("click", {destination: "32974", com: 0x32, param1: 0x64, param2: 0x00}, SendBusCommand);
$("#WZJalFrontZu").bind("click", {destination: "32974", com: 0x32, param1: 0x00, param2: 0x00}, SendBusCommand);
$("#WZJalSeiteAuf").bind("click", {destination: "32974", com: 0x32, param1: 0x64, param2: 0x00}, SendBusCommand);
$("#WZJalSeiteZu").bind("click", {destination: "32974", com: 0x32, param1: 0x00, param2: 0x00}, SendBusCommand);
});
</script>
</head>

<body>
<div class="gobalwrapper" style="font-size:24px">
<h1>Bus Webfrontend</h1>
<p class="buttons">
<h2>Licht Gesamt</h2>
<button id="EGAus">EG Aus</button>
<button id="OGAus">OG Aus</button>
<button id="AllesAus">Alles Aus</button>
</p>
<p class="buttons">
<td><h2>Jalousie Gesamt</h2></td>
<td><button id="AlleZu">Alle Zu</button></td>
<td><button id="EGZu">EG Zu</button></td>
<td><button id="OGZu">OG Zu</button></td>
</p>
<p class="buttons">
<td><button id="AlleAuf">Alle Auf</button></td>
<td><button id="EGAuf">EG Auf</button></td>
<td><button id="OGAuf">OG Auf</button></td>
</p>
<p class="buttons">
<h2>Licht Wohnzimmer</h2>
<button id="WZToggle">Fluter</button>
<button id="WZWToggle">Wand</button>
</p>
<p class="buttons">

<button id="WZJalFrontZu">Front Zu</button>
<button id="WZJalSeiteZu">Erker Zu</button>
</p>
<p class="buttons">
<button id="WZJalFrontAuf">Front Auf</button>
<button id="WZJalSeiteAuf">Erker Auf</button>
</p>
<p class="buttons">
<h2>Esszimmer</h2>
<button id="EZToggle">Licht</button>
<button id="EZAn">An</button>
<button id="EZAus">Aus</button>
</p>
<p class="buttons">
<h2>Küche</h2>
<button id="KuToggle">Licht</button>
</p>
<p class="buttons">
<h2>Schlafzimmer</h2>
<button id="SZToggle">Licht</button>
<button id="SZAn">An</button>
<button id="SZAus">Aus</button>
<button id="SZKabuff">Kabuff Aus</button>
<input type="range" class="myslider" name="slider-1" id="slider-1" value="60" min="0" max="100" />
</p>
<p class="buttons">
<h2>Bad</h2>
<button id="BADDLicht">Licht</button>
<button id="BADSLicht">Spiegel</button>
</p>
<p class="buttons">
<h2>Außen</h2>
<button id="AUELicht">Eingang</button>
<button id="AUTLicht">Terasse</button>
<button id="AUSteck">Steckdose</button>
</p>
</div>
</body>
</html>

最佳答案

The button sizing works fine for all my devices, but changing the button font-size withing the section does not have an effect on the font size when viewed from a iOS device. I helped myself around this problem by setting the font-size within the html body. Is there an obvious reason for this behaviour?

调用 .button() 方法后,JQuery UI 通过应用少量 css 类并在其中添加 span 来更改按钮的 html 代码。如果你想改变字体大小——你应该这样写:

<style type="text/css">
.ui-button span {
font-size: 10px;
}
</style>

但更改 ui 元素外观的更好方法是创建您自己的主题或选择一些预制的主题 (http://jqueryui.com/themeroller/)。

Could somebody please point me to an example where there is a button in line with a slider and a numeric field that shows the slider value. Of course I have looked at the standard Jquery slider example but whatever combination of syntax I tried using classes to manipulate the styling I never came out with an inline slider the size, position (inline) and label that I wanted.

使用显示:内联 block ;用于按钮和 slider 。

关于javascript - 使用 Jquery 自定义按钮和 slider (大小、位置、标题大小),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19938359/

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