如何确定CSS切换输入的“切换”状态?(How to determine the 'toggle' status of a CSS toggle input?)
我想实现一个基于CSS的切换/切换输入。 我发现以下链接的例子非常简单,根本不使用JavaScript。 问题在于它缺少关于如何确定'切换'状态的解释
http://www.w3schools.com/howto/howto_css_switch.asp
这是完整的参考代码:
/* The switch - the box around the slider */ .switch { position: relative; display: inline-block; width: 60px; height: 34px; } /* Hide default HTML checkbox */ .switch input {display:none;} /* The slider */ .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; -webkit-transition: .4s; transition: .4s; border-radius: 34px; } .slider:before { position: absolute; content: ""; height: 26px; width: 26px; left: 4px; bottom: 4px; background-color: white; -webkit-transition: .4s; transition: .4s; border-radius: 50%; } input:checked + .slider { background-color: #2196F3; } input:focus + .slider { box-shadow: 0 0 1px #2196F3; } input:checked + .slider:before { -webkit-transform: translateX(26px); -ms-transform: translateX(26px); transform: translateX(26px); }
<!-- Rounded switch --> <label class="switch"> <input type="checkbox"> <div class="slider"></div> </label>
I would like to implement a CSS-based toggle/switch input. I found the example of the following link which is really easy and not using javascript at all. The problem is that it's lacking the explanation of how to determine the 'toggle' status
http://www.w3schools.com/howto/howto_css_switch.asp
This is the full code for reference:
/* The switch - the box around the slider */ .switch { position: relative; display: inline-block; width: 60px; height: 34px; } /* Hide default HTML checkbox */ .switch input {display:none;} /* The slider */ .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; -webkit-transition: .4s; transition: .4s; border-radius: 34px; } .slider:before { position: absolute; content: ""; height: 26px; width: 26px; left: 4px; bottom: 4px; background-color: white; -webkit-transition: .4s; transition: .4s; border-radius: 50%; } input:checked + .slider { background-color: #2196F3; } input:focus + .slider { box-shadow: 0 0 1px #2196F3; } input:checked + .slider:before { -webkit-transform: translateX(26px); -ms-transform: translateX(26px); transform: translateX(26px); }
<!-- Rounded switch --> <label class="switch"> <input type="checkbox"> <div class="slider"></div> </label>
原文:https://stackoverflow.com/questions/40317740
更新时间:2023-08-23 06:08
最满意答案
在rs中获取结果集后尝试这个:
PreparedStatement st = (PreparedStatement) con.prepareStatement("insert into temp values(?)"); i=0; while(rs.next()) { st.setString(1,anArray[i]); st.executeUpdate(); i++; }
try this after getting resultset in rs:
PreparedStatement st = (PreparedStatement) con.prepareStatement("insert into temp values(?)"); i=0; while(rs.next()) { st.setString(1,anArray[i]); st.executeUpdate(); i++; }
相关问答
更多-
有什么数据库专业书籍介绍?[2022-05-19]
mysql -
从android(java)数组中的sqlite获取并存储列值(Fetch and store a column values from sqlite in android(java) array)[2023-04-20]
我认为使用rawQuery是一个坏习惯,尽量避免这种情况(除极端情况外) 请尝试以下方法来解决您的问题,希望这会对您有所帮助: public ArrayListgetAllStringValues() { ArrayList yourStringValues = new ArrayList (); Cursor result = db.query(true, YOUR_TABLE, new String[] { YOUR ... -
您可以随时序列化数组并将其存储在数据库中。 PHP序列化 然后,您可以在需要时取消对数组进行序列化。 You can always serialize the array and store that in the database. PHP Serialize You can then unserialize the array when needed.
-
如何在MySQL中存储数组?(How to store arrays in MySQL?)[2023-08-15]
正确的方法是使用多个表并在查询中JOIN它们。 例如: CREATE TABLE person ( `id` INT NOT NULL PRIMARY KEY, `name` VARCHAR(50) ); CREATE TABLE fruits ( `fruit_name` VARCHAR(20) NOT NULL PRIMARY KEY, `color` VARCHAR(20), `price` INT ); CREATE TABLE person_fruit ( `person_id` INT NO ... -
您可以向表中添加“index”或“id”列或使用此代码 $index = 0; $q = mysql_query("SELECT Indicators FROM geographic_main"); while(list($indicator) = @mysql_fetch_row($q)) { mysql_query("UPDATE geographic_main SET Weight='".$weights[$index++]."' WHERE Indicators='$indicator'"); ...
-
首先,你真的不想那样做。 RDBMS中的列是原子的,因为它包含一条且只有一条信息。 尝试在列中存储多个数据是违反第一范式的。 如果您绝对必须这样做,那么您需要将数据转换为可以存储为单个数据项(通常是字符串)的表单。 您可以使用PHP的serialize()机制,XML解析(如果数据恰好是文档树),json_encode()等。 但是,您如何有效地查询这些数据? 答案是你不能。 此外,如果其他人在以后接管你的项目,你真的会惹恼他们,因为数据库中的序列化数据是可怕的。 我知道因为我继承了这样的项目。 我提到你真 ...
-
在mysql中存储numpy数组(store numpy array in mysql)[2022-02-15]
您可以使用ndarray.dumps()将其pickle为字符串然后将其写入BLOB字段? 使用numpy.loads()恢复它 You could use ndarray.dumps() to pickle it to a string then write it to a BLOB field? Recover it using numpy.loads() -
在rs中获取结果集后尝试这个: PreparedStatement st = (PreparedStatement) con.prepareStatement("insert into temp values(?)"); i=0; while(rs.next()) { st.setString(1,anArray[i]); st.executeUpdate(); i++; } try this after getting result ...
-
如果要将byte[]转换为sql类型Blob ,可以执行以下操作: @Lob(type = LobType.BLOB) 要么 @Type(type = "org.hibernate.type.BlobType") @Lob 希望能帮助到你 Well, I have tried your suggestions @Ernusc. The first one: @Lob(type = LobType.BLOB) private byte[] blobImg; it is no compiling for ...
-
我认为在添加列时不需要指定“COLUMN”关键字。 以下是添加列的正确语法 ALTER TABLE table_name ADD column_name datatype 所以你的语句创建行应该是这样的, PreparedStatement pst=con.prepareStatement("alter table distable add ? varchar(50)"); 更新 :刚想通了吗? 参数仅适用于数据,不适用于列名称。 如果您需要以这种方式生成列名称,则可以使用字符串连接。 例如, "al ...