我不知道为什么这个简单的CSS不起作用......
.app a {
height: 18px;
width: 140px;
padding: 0;
overflow: hidden;
position: relative;
margin: 0 5px 0 5px;
text-align: center;
text-decoration: none;
text-overflow: ellipsis;
white-space: nowrap;
color: #000;
}Run Code Online (Sandbox Code Playgroud)
<div class="app">
<a href="">Test Test Test Test Test Test</a>
</div>Run Code Online (Sandbox Code Playgroud)
应该在4号"测试"周围切断
我希望用户能够将URL地址的一部分更改为其邮政编码.我有一个文本框和按钮,我希望将该值提交给URL.
jQuery的:
jQuery(document).ready(function($) {
$.ajax({
url : "http://SomeAddress.com/" + PostCode + ".json",
dataType : "jsonp",
success : function(parsed_json) {
Run Code Online (Sandbox Code Playgroud)
HTML:
<input type="text" id="GetPostCode" />
<button id="SetPostCode">Set This Post Code</button>
Run Code Online (Sandbox Code Playgroud)
jQuery的:
$("#SetPostCode").click(function() {
var PostCode = document.getElementById("GetPostCode").value;
$("#GetPostCode").val(" ");
return false;
});
Run Code Online (Sandbox Code Playgroud)
我明白了这一行
$.ajax({
url : "http://api.wunderground.com/api/2508132ae0c7601a/geolookup/conditions/q/UK/" + PostCode + ".json",
Run Code Online (Sandbox Code Playgroud)
不这样做,但我不知道还能做什么.有人可以告诉我我需要做什么才能使这个工作?
我试图在它被删除时获得特定div的位置.在一些帮助下,我把代码放在一起.我在最后一位添加了尝试获取特定值,但它只返回[object Object]而不是[0,0]或[0,120].
所以问题是如何从数组中获取实际值?
这是一个jsFiddle
$(function() {
$('.AppList').droppable({
accept: ".App",
tolerance: 'fit',
drop: function(event, ui) {
var apps = $(".App"),
positions = [];
$.each(apps, function (index, app) {
var positionInfo = $(app).position();
positions.push(positionInfo);
});
var Time = positions.slice(0,1);
var x=document.getElementById("posThis");
x.innerHTML=Time;
console.log(positions);
}
});
});
Run Code Online (Sandbox Code Playgroud) 你好我有麻烦递增opacity一个的background-color:hsla() div使用JavaScript.这是我正在使用的代码......
$( "#Opacity" ).button().click(function() {
var x = 0.1;
var Opacity = ++x;
$( "#TimeDate, #Weather, #ticker, #Pages" ).css( "background-color", "hsla(0,0%,0%,"+Opacity +")" );
Cookie.set('bgo', $('#TimeDate, #Weather, #ticker, #Pages').css('background-color'), 365);
return false;
});
Run Code Online (Sandbox Code Playgroud)
我想要的最终结果是不透明度在前一个设置下开始,然后每次单击按钮时增加0.1,直到达到1,然后返回到0然后再开始增加0.1再次点击等等.
谢谢,克里斯
当点击一个按钮时,我试图在我的"AppList"中添加一个新的"app".
JS
$(".appCreate" ).click(newApp);
function newApp() {
var facebookTemp = $("#facebook-template").html();
var appName = $(this).data("appName");
var appSize = $(this).data("appSize");
var appTemp = $(this).data("appTemp");
$("<div class=\"app" + appName + appSize + "\"></div>").html(appTemp).appendTo(".AppList");
};
Run Code Online (Sandbox Code Playgroud)
HTML
<body>
<section id="AppBox">
<div class="AppList">
<!-- == Facebook == -->
<div id="facebook-template">
<div class="App facebook Size170x290">
<h1>Hello Test</h1>
</div>
</div>
</div>
</section>
<!-- == Settings == -->
<section id="dialog-settings" class="dialog" title="Settings">
<button data-appName="facebook" data-appSize="Size170x290" data-appTemp="facebookTemp" class="appCreate">
Facebook</button>
</section>
</body>
Run Code Online (Sandbox Code Playgroud)
CSS
#facebook-template {
display: none;
}
.facebook { …Run Code Online (Sandbox Code Playgroud) 您好我正在尝试使用Wunderground Weather API,但我在按钮点击请求信息时遇到麻烦.这是工作开放线提供:
jQuery(document).ready(function($) {
Run Code Online (Sandbox Code Playgroud)
以下是我将其更改为:
jQuery('#GetWeather').click(function($) {
Run Code Online (Sandbox Code Playgroud)
当我点击按钮时,我得到一个firebug错误:
TypeError: $.ajax is not a function
[Break On This Error]
success : function(parsed_json) {
Run Code Online (Sandbox Code Playgroud)
我不知道为什么它不会工作,但这是其余的代码...希望它有所帮助:
jQuery('#GetWeather').click(function($) {
var PostCode="PL9 9UT";
$.ajax({ url : "http://api.wunderground.com/api/2508132ae0c7601a/geolookup/conditions/q/UK/"+PostCode +".json",
dataType : "jsonp",
success : function(parsed_json) {
var icon = parsed_json['current_observation']['icon'];
var temp_c = parsed_json['current_observation']['temp_c'];
var feelslike_c = parsed_json['current_observation']['feelslike_c'];
var visibility_mi = parsed_json['current_observation']['visibility_mi'];
var UV = parsed_json['current_observation']['UV'];
var relative_humidity = parsed_json['current_observation']['relative_humidity'];
var wind_mph = parsed_json['current_observation']['wind_mph'];
var pressure_mb = parsed_json['current_observation']['pressure_mb'];
var wind_string = parsed_json['current_observation']['wind_string'];
var …Run Code Online (Sandbox Code Playgroud)