我有两个表,一个用于新闻,另一个用于评论,我想得到其状态已被批准的评论的计数.
SELECT
ccc_news . *,
count(if(ccc_news_comments.id = 'approved', ccc_news_comments.id, 0)) AS comments
FROM
ccc_news
LEFT JOIN
ccc_news_comments
ON ccc_news_comments.news_id = ccc_news.news_id
WHERE
`ccc_news`.`category` = 'news_layer2'
AND `ccc_news`.`status` = 'Active'
GROUP BY
ccc_news.news_id
ORDER BY
ccc_news.set_order ASC
LIMIT 20
Run Code Online (Sandbox Code Playgroud)
但是这个查询的问题是,对于该列提取的最小值是1是否存在与该消息相对应的任何注释.
任何帮助都会非常值得赞赏.
我所知道的东西一样onchange,onmousedown而且onmouseup但有一个很好的参考的地方,列出所有的人都完全可能用一个,他们覆盖的元素列表?
嗨我有一段HTML基本上做SVG动画的代码.这适用于Chrome和Firefox,但不适用于IE9/IE10.
有解决方案吗
需要单个代码库,至少在Chrome/Firefox/IE 9及更高版本中有效.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<div id='svgnotsupported' style='visibility: hidden;'>
<h1>This application requires SVG support</h1>
</div>
<div id='svgsupported' style='visibility: hidden'></div>
<script>
var svgsupport;
window.onload = function supportsSvg() {
var ua = navigator.userAgent;
var M = ua.match(/(chrome)\/?\s*(\.?\d+(\.\d+)*)/i);
var b = document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.0")
if(b || M) {
svgsupport = document.getElementById('svgsupported');
} else {
svgsupport = document.getElementById('svgnotsupported');
}
svgsupport.style.visibility = 'visible';
}
</script>
<svg id="no_fewer_than_N_events_E_between_event_Q_and_first_R_thereafter" width="588" height="578" version="1.1" xmlns="http://www.w3.org/2000/svg">
<defs>
<marker id="Triangle" viewBox="0 …Run Code Online (Sandbox Code Playgroud) function g () {
var x;
function y () {};
var z;
}
Run Code Online (Sandbox Code Playgroud)
我想知道上面的代码在提升时的确切顺序.
理论1:var s和functions 之间的顺序保持原样:
function g () {
var x;
function y () {};
var z;
}
Run Code Online (Sandbox Code Playgroud)
理论2: var先到functions:
function g () {
var x;
var z;
function y () {};
}
Run Code Online (Sandbox Code Playgroud)
理论3: function先到vars:
function g () {
function y () {};
var x;
var z;
}
Run Code Online (Sandbox Code Playgroud)
哪种理论是正确的?
我想改变cursor拖动时的,所以我尝试这种方式:
function drag (event) {
localStorage.setItem("no", $(event.target).data("no"));
$("html").css("cursor", "move");
}Run Code Online (Sandbox Code Playgroud)
<tr draggable="true" class="memo_item move" id="memo_<?php echo $memo->memo_no?>" ondragstart="drag(event, this);" data-no="<?php echo $memo->memo_no?>"></tr>Run Code Online (Sandbox Code Playgroud)
但它不起作用。
而且我不能用JQueryUi。
如何更改光标?
我正在尝试将此Popmotion示例转换为GreenSock.
https://codepen.io/popmotion/pen/xVeWmm
var SELECTOR = '.box';
var velocityRange = [-1000, 1000];
var maxRotate = 30;
var smoothing = 100;
var box = ui.select(SELECTOR, {
values: {
x: 0,
y: 0,
rotateY: {
watch: function (actor) {
return actor.values.x.velocity;
},
mapFrom: velocityRange,
mapTo: [-maxRotate, maxRotate],
smooth: smoothing
},
rotateX: {
watch: function (actor) {
return actor.values.y.velocity;
},
mapFrom: velocityRange,
mapTo: [maxRotate, -maxRotate],
smooth: smoothing
}
}
});
var track2D = new ui.Track({
values: {
x: {},
y: …Run Code Online (Sandbox Code Playgroud) 我一直在寻找一种在Bootstrap 4中构建手风琴的方法,该方法将每个面板从左到右而不是从上到下排列。此外,我正在尝试找到一种解决方案,将可点击的标题旋转90度,并向内容的左侧旋转。
我从前看过这篇文章:
Twitter Bootstrap折叠插件方向-水平而非垂直
但是,所有解决方案似乎都不起作用,或者对于手风琴而言。理想情况下,手风琴将装满width容器并保持该容器width。我模拟了两种状态下的外观:
我想知道如何验证来自a的输入值Datalist.我的意思是,如果我有一个Datalist用户可以开始写入值然后从中选择它的位置Datalist,但是用户决定不从列表中选择任何值并且他提交具有不完整值的表单,则发送值会错的.
我想过迭代所有的元素,Datalist但我认为如果Datalist有超过1.000的值并且我不知道任何其他方式来验证它,这不是一个好主意.
这是Datalist我要使用的一个例子:
<input type="text" list="colours">
<datalist id="colours">
<option value="Red" data-id="1">
<option value="Blue" data-id="2">
<option value="Green" data-id="3">
<option value="Black" data-id="4">
<option value="White" data-id="5">
</datalist>
Run Code Online (Sandbox Code Playgroud) 我有以下代码:
var GoalPanelView = Backbone.View.extend({
// Bind to the goal panel DOM element
el: $("#sidebar-goals"),
// Initialize the collection
initialize: function() {
this.collection = Goals;
this.collection.bind('add', this.appendItem);
},
// Create a new goal when a user presses enter in the enter goal input
createOnEnter: function(e) {
if (e.keyCode != 13) return;
this.addItem();
//Goals.create(this.newAttributes());
},
// Add the goal item to the goal list
addItem: function() {
var goal = new Goal();
goal.set(this.newAttributes());
var goalsElem = this.el;
this.collection.add(goal);
$(this.el).children("#enter-goal").val('');
},
// …Run Code Online (Sandbox Code Playgroud) 我正在尝试组合两个数组,大多数答案都涉及将第二个数组添加到第一个数组的末尾.我需要将索引合并到索引.
这是示例代码:
let arr1 = ['golf', 'hockey', 'tennis'];
let arr2 = ['player1', 'player2', 'player3'];
Array.prototype.zip = function (arr) {
return this.map(function (e, i) {
return [ e, arr[i]];
})
};
const arr3 = arr1.zip(arr2);
console.log(arr3);Run Code Online (Sandbox Code Playgroud)
结果应该是:
['golf', 'player1', 'hockey', 'player2', 'tennis', 'player3']
Run Code Online (Sandbox Code Playgroud)
上面的代码看起来应该可以工作但不会.如果它可以修复,或交换更好,那将是伟大的.....
javascript ×7
animation ×2
html ×2
accordion ×1
arrays ×1
backbone.js ×1
bootstrap-4 ×1
browser ×1
client-side ×1
count ×1
css ×1
greensock ×1
hoisting ×1
html5 ×1
if-statement ×1
join ×1
jquery ×1
mysql ×1
popmotion ×1
svg ×1
this ×1