我正在使用jQuery来过滤页面上的产品项目(隐藏和显示DIV)我使用过滤器作为替代,因为PHP $ _GET有点旧,我们正试图通过jQuery来做到这一点.我使用filter()和data属性.
如何关闭除现有项目之外的当前复选框选项?如何根据选择隐藏项目,何时不隐藏?
<input type="checkbox" id="drama" onClick="filterCategory(this.value)" value="drama" /> Drama<br />
<input type="checkbox" id="romance" onClick="filterCategory(this.value)" value="" /> Romance<br />
<input type="checkbox" id="horror" onClick="filterCategory(this.value)" value="horror" /> Horror<br />
<!--------------------->
<div class="products">
<div class="productItem" data-price="250" data-category="horror">
Scary Book
<div class="productItemPrice"><span>£250</span></div>
</div>
<div class="productItem" data-price="150" data-category="drama">
Drama Poems
<div class="productItemPrice"><span>£150</span></div>
</div>
<div class="productItem" data-price="250" data-category="romance">
Love Story
<div class="productItemPrice"><span>£250</span></div>
</div>
<div class="productItem" data-price="241" data-category="horror">
Creep Book
<div class="productItemPrice"><span>£241</span></div>
</div>
</div>
<!--------------------->
Run Code Online (Sandbox Code Playgroud)
function filterCategory(id) {
var pid=$(".productItem"); // Which product is …Run Code Online (Sandbox Code Playgroud) SELECT *
FROM `products`
WHERE (
`category` = 'a'
AND `category` = 'b'
)
Run Code Online (Sandbox Code Playgroud)
products
---
id sku category
-------------------------
1 34343 a
2 32523 d
3 23234 b
4 23433 b
5 23442 c
Run Code Online (Sandbox Code Playgroud)
我想要回归A和B.
我正在构建一个简单的汽车数据库应用.当用户添加新车时,它会创建以下JSON数据,其中包含库的空白字段:
{
"name": "Cars",
"gallery": [{
"img": "http://",
"title": "BMW"
}, {
"img": "http://",
"title": "Lexus"
}, {
"img": "http://",
"title": "Ferrari"
}],
"pageId": "23",
"storeURL": "/app/cars/gallery"
}
Run Code Online (Sandbox Code Playgroud)
现在我想在应用程序中做的是,如果用户添加新的图库图像,它应该在最后一个图库图片之后添加新的图片.所以在法拉利之后应该插入一个新对象.我似乎无法做到这一点,因为每个教程都会导致死胡同,官方Google文档也指定set()将替换所有数据,因此如果您使用update()它将添加,在这种情况下它不会添加.
此代码删除所有数据:
function add(){
var data = [
{
title: 'Mercedes',
img: 'http://'
}
]
var postData = {
pageGallery: data
};
var updates = {};
updates['/app/cars/'] = postData;
firebase.database().ref().update(updates);
console.log('New car added');
}
Run Code Online (Sandbox Code Playgroud)
如果我改变并添加孩子:
firebase.database().ref().child('gallery').update(updates);
Run Code Online (Sandbox Code Playgroud)
它没有做任何事情来做数据.你能帮忙吗?
我无法在 React 中打印简单的 JavaScript 日期。
import React, { Component } from 'react';
import './ActivityWarningText.css';
class ActivityWarningText extends Component {
render() {
const str = new Date();
return(
<div>
<h1>All activity is recorded. {str}</h1>
</div>
)
}
}
export default ActivityWarningText;
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
Objects are not valid as a React child (found: Wed Apr 25 2018 18:09:03 GMT+0400 (Arabian Standard Time)). If you meant to render a collection of children, use an array instead.
in h1 (at index.js:17)
in div (at index.js:16) …Run Code Online (Sandbox Code Playgroud) 我们都知道xHTML/CSS和JS缩小和压缩有利于大型流量站点.
看看下面的代码:
include("template.funcs.php");
include("country-redirect.php");
if(($country=='PL')||($country=='POL'))
{
header('Location: index_pol.php');
exit();
}
$include_path = './global_php/';
$page = "couture";
include $include_path."shop.inc.php";
$movie_num = 1 ;
Run Code Online (Sandbox Code Playgroud)
现在看看minifed版本:
include("template.funcs.php");include("country-redirect.php");
if(($country=='PL')||($country=='POL')){header('Location: index_pol.php');
exit();}
$include_path='./global_php/';$page="couture";include $include_path."shop.inc.php";
$movie_num=1;
Run Code Online (Sandbox Code Playgroud)
您认为哪一个更快 - 一般来说,我也想开始缩小我的编程,小的var和字符串名称,如$ a而不是$ apple,并试图删除尽可能多的额外字符.PHP编译器会像压缩块还是间隔一块?
<div class="twtr-tweet-text">
<p>lorem ipsum <em>date 19th nov</em></p>
</div>
<div class="twtr-tweet-text">
<p>lorem ipsum <em>date 18th nov</em></p>
</div>
<div class="twtr-tweet-text">
<p>lorem ipsum <em>date 17th nov</em></p>
</div>
Run Code Online (Sandbox Code Playgroud)
如何将此块转换为下面的代码.请记住,多个块包含相同的类名等.
<div class="twtr-tweet-text">
<p><img src="speech_left.jpg" />lorem ipsum <img src="speech_right.jpg" /><em>date 19th nov</em></p>
</div>
Run Code Online (Sandbox Code Playgroud)
所以在<em>开始标记之前和之后的<p>标记之后.twtr-tweet-text{}.
<style type="text/css">
.button2 {
font-family: "Georgia Pro", Georgia;
background: #000;
color: #fff;
text-decoration: none;
padding: 5px 15px;
border: 3px solid #000;
font-size: 14px;
}
.button2:hover {
border: 3px solid #000;
background: #fff;
color:#000;
}
</style>
<a href="#link" class="button2" title="ADD TO SHOPPING BAG"><span>ADD TO SHOPPING BAG</span></a>
Run Code Online (Sandbox Code Playgroud)
这是我的代码.我想这样做,当用户在链接上移动时,悬停框从底部或顶部移动并进入?我是CSS3过渡的新手,并不了解整体s和width事物或height?唯一的问题是我希望它或多或少可能流畅,更好地处理响应式设计..思考em和auto高度?
jsFiddle:http://jsfiddle.net/Ysr7W/2/
样本悬停:

我试图在OpenCart中创建两个全局变量.我基本上希望能够在我的任何.tpl文件中声明它们
<?php echo $global1; ?>
Run Code Online (Sandbox Code Playgroud)
我已经尝试过编辑,library/system.php也config.php可以$global1="test"在我的文件中添加内容.但是在.tpl文件中调用它不起作用?
例如,看下面的文件,我希望能够随时调用这些变量..我是否需要编辑config.php或者什么?该示例显示了$header在每个.tpl文件上使用的调用.
not_found.tpl
<?=$header?>
<div class="breadcrumb">
<? foreach ($breadcrumbs as $breadcrumb) { ?>
<? $breadcrumb['separator']; ?><a href="<?=$breadcrumb['href']?>"><?=$breadcrumb['text']?></a>
<? } ?>
</div>
<div id="content">
<?=$global1?>
<img src="/catalog/view/theme/default/image/error.png"/>
</div>
<?=$footer?>
Run Code Online (Sandbox Code Playgroud)
/catalog/controller/common/header.php
<?php
class ControllerCommonHeader extends Controller {
protected function index() {
// NEW GLOBAL VARS
$cdnDefault="//www.gorgeouscouturedev.com/catalog/view/theme/";
$currentUseLang = $this->language->get('code');
Run Code Online (Sandbox Code Playgroud)
现在在/catalog/view/theme/default/template/common/home.tpl
<?=$header?>
<?=$column_left?>
<?=$column_right?>
<div id="content">
<? echo $cdnDefault ?>
<? echo $currentUseLang ?> …Run Code Online (Sandbox Code Playgroud) 我正在使用highcharts和highstock并且有一些图表使用rangeSelector.
一切正常,但我想获取当前选定的范围(当用户点击其中一个rangeSelector按钮时),这样我就可以将它存储在一个cookie中,以便下次默认显示我想要显示的范围.
到目前为止,我已经尝试了各种各样的东西,比如添加一个chart.events.redraw测试来尝试捕获chart.rangeSelector.buttons对象,但它似乎并没有包含任何有趣的东西.
对我来说,理想情况是rangeselector.buttons上的事件回调,带有一个简单的getter函数,比如chart.rangeSelector.buttons[x].setState()命名为chart.rangeSelector.buttons[x].getState()?
我很惊讶这不存在......我必须遗漏一些东西.有人可以提供帮助吗?
我试图确保这些组合中的任何一个 - 将始终显示没有小数或没有逗号的四舍五入数字。例子
1,200.00 should output = 1200
12.33 should output = 12
123.34 should output = 123
1,434 should output = 1434
165,33 should output = 165
250.00 should output = 250
259,00 should output = 259
Run Code Online (Sandbox Code Playgroud)
我努力了:
var currency = "$1,100.00";
var number = Number(currency.replace(/[^0-9\.]+/g,""));
Run Code Online (Sandbox Code Playgroud)
还有我的最新消息:
var priceTotal = parseFloat(price.replace( /[^\d\.]*/g, ''));
Run Code Online (Sandbox Code Playgroud)
但这对于逗号来说效果不佳。显示时必须始终不带逗号、点或最后一位数字。