我正在使用自定义switch
切换(从这里),我想添加一个图标而不是常规文本.当我将Ionicons
代码粘贴到CSS content
属性时,它显示为一个矩形(表示没有找到字符\ font的事实).我如何通过这个?
编辑:我忘了添加,我已经包含了CDN的CSS.
切换CSS:
.onoffswitch {
position: relative;
width: 108px;
-webkit-user-select:none;
-moz-user-select:none;
-ms-user-select: none;
}
.onoffswitch-checkbox {
display: none;
}
.onoffswitch-label {
display: block;
overflow: hidden;
cursor: pointer;
border: 2px solid #999999;
border-radius: 30px;
}
.onoffswitch-inner {
display: block;
width: 200%;
margin-left: -100%;
-moz-transition: margin 0.3s ease-in 0s;
-webkit-transition: margin 0.3s ease-in 0s;
-o-transition: margin 0.3s ease-in 0s;
transition: margin 0.3s ease-in 0s;
}
.onoffswitch-inner:before, .onoffswitch-inner:after {
display: block;
float: left; …
Run Code Online (Sandbox Code Playgroud) 我正在尝试显示一些文本,最大高度(文本框的)为 4 行,如果文本较长,我想显示三个点(...)。为了达到这种效果,这是我使用的代码:
.txt{
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical;
}
Run Code Online (Sandbox Code Playgroud)
这基本上完全按照我想要的方式工作,但是如果我将文本方向设置为 ,则不会显示三个点rtl
。无法理解是什么原因。CodePen 在这里。
.txt{
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical;
}
Run Code Online (Sandbox Code Playgroud)
.wrapper {
padding: 10px;
background: #eaeaea;
max-width: 400px;
margin: 20px;
}
.txt {
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical;
}
.demo-1 {
direction: ltr;
}
.demo-2 {
direction: rtl;
}
Run Code Online (Sandbox Code Playgroud)
我试图在按钮点击时重置所选日期,但到目前为止我只能清除input
元素,而不是选择器上的实际日期.以下代码重置了所有内容,包括配置和日期,因此它显然不是我需要的.
$('#datepicker').datepicker('update',''); //resets everything
Run Code Online (Sandbox Code Playgroud)
详细说明:用户只能选择当天7天后的日期.还有一个按钮,用户可以从选择器中清除所选日期,并选择一个新日期.现在,清除功能只能清除拾取器中的输入元素(但不能清除拾取器元素中的实际日期),或清除选择器配置中的选择(例如startDate:"+ 7d".我想仅清除所选日期,而不重置所有内容.
这是我到目前为止提出的:
HTML:
<div id="myDatepicker" class="input-group date">
<input type="text" class="form-control" id="datepick">
<span class="input-group-addon">
<i class="fa fa-calendar"></i>
</span>
<a href="#" id="duration_tag"></a>
</div>
<button type="button" id="clear">clear</button>
Run Code Online (Sandbox Code Playgroud)
jQuery的:
$(document).ready(function() {
$("#clear").click(function(){
$('#datepick').val(" ").datepicker({startDate: "+7d"});
});
$('#myDatepicker').datepicker({
startDate: "+7d",
});
$('#myDatepicker').on('changeDate', function(e){
$(this).datepicker('hide');
});
});
Run Code Online (Sandbox Code Playgroud) 我想在div中放置一个大图像,让用户使用鼠标滚动图像(单击并拖动到所需的方向).如何实现这种效果?
CSS:
#image{
position: relative;
margin: 0 auto;
width: 600px;
height: 400px;
top: 300px;
background: url("http://www.treasurebeachhotel.com/images/property_assets/treasure/page-bg.jpg") no-repeat;
}
Run Code Online (Sandbox Code Playgroud)
HTML:
<div id="image"></div>
Run Code Online (Sandbox Code Playgroud)
编辑:
我想自己实现这一点以获取知识,第三方框架是最后的手段.
我正在尝试使用带圆头的CSS(顶部边缘,而不是三角形)创建一个V形状,但是无法实现这一点.有人可以帮忙吗?在这里演示.
CSS:
#shape{
width: 100px;
height: 100px;
background-color: lightblue;
-webkit-clip-path: polygon(100% 100%, 0 100%, 0 0, 52% 16%, 100% 0);
clip-path: polygon(100% 100%, 0 100%, 0 0, 52% 16%, 100% 0);
}
Run Code Online (Sandbox Code Playgroud)
我允许用户上传多个文件。然后我需要迭代这些文件并执行一些操作。我想添加一些额外的功能FileList
,但 TS 不知道forEach
数组FileList
。这是我的代码:
public uploadMultiple(evt){
console.log(evt.files);
FileList.prototype.forEach = function(callback) {[].forEach.call(this, callback)};
}
Run Code Online (Sandbox Code Playgroud) 我现在正在学习Scala,我试图将一个元组传递给一个用for循环打印所有元素的函数.这是我到目前为止所做的,但显然出了问题.
object Tuple_demo {
def main(args: Array[String])
{
var tup1=(10,"test",6.8)
printMe(tup1)
}
def printMe(tup1:Tuple1)
{
for (ob<-tup1)
{
println(ob)
}
}
}
Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我有一个自定义User
类,它包含一些常规数据(名称等...).我需要保存该对象并随时随地在应用程序的其他页面中获取它.我public final class GeneralMethods
用很多方法制作了一个助手类,我经常使用它(当然是静态的).
为了使用Gson
库保存数据Im .我做了这个方法:
public static void saveData(Context con, String variable, String data)
{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(con);
prefs.edit().putString(variable, data).apply();
}
Run Code Online (Sandbox Code Playgroud)
要保存对象,我使用此方法如下:
Gson gson = new Gson();
String stringUser = gson.toJson(newUser);
GeneralMethods.saveData(VerificationActivity.this,"userObject",stringUser);
Run Code Online (Sandbox Code Playgroud)
要重新加载数据,我正在使用这个静态方法:
public static String getData(Context con, String variable, String defaultValue)
{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(con);
String data = prefs.getString(variable, defaultValue);
return data;
}
Run Code Online (Sandbox Code Playgroud)
我真的不知道如何获取数据,这是我到目前为止所做的:
Gson gson = new Gson();
String user="";
String value="";
user = GeneralMethods.getData(SplashScreenActivity.this,value,"userObject");
Run Code Online (Sandbox Code Playgroud)
我正在努力解决这个问题getData
,如何解析数据从String …
我在我的应用程序中使用Bootstrap 3.我正在尝试创建两个矩形,一个较小的矩形位于两个顶部,在它们的"边界"的中间,就像在我附加的图像中看到的那样.这就是我到目前为止所做的:
HTML:
<div class="row">
<div class="col-sm-3 center">
<!-- place holder for extra content-->
</div> <!-- end of div lg col 3 -->
<div class="col-sm-3 center x">
</div> <!-- end of div lg col 3 -->
<div id="both">hello</div>
<div class="col-sm-3 center x">
</div> <!-- end of div lg col 3 -->
<div class="col-sm-3 center">
<!-- place holder for extra content-->
</div> <!-- end of div lg col 3 -->
</div><!-- end of first row div-->
Run Code Online (Sandbox Code Playgroud)
CSS3:
.center.x{
border: 1px solid …
Run Code Online (Sandbox Code Playgroud) 我有一个字符串,我需要通过某个分隔符拆分并转换为数组,但不删除分隔符本身.例如,请考虑以下代码:
var str = "#mavic#phantom#spark";
str.split("#") //["", "mavic", "phantom", "spark"]
Run Code Online (Sandbox Code Playgroud)
我需要输出如下:
["#mavic", "#phantom", "#spark"]
Run Code Online (Sandbox Code Playgroud)
我在这里读到但这并没有回答我的问题.
html ×5
css ×4
css3 ×2
javascript ×2
jquery ×2
typescript ×2
android ×1
css-shapes ×1
datepicker ×1
draggable ×1
filelist ×1
gson ×1
html5 ×1
ionicons ×1
java ×1
scala ×1
tuples ×1