我需要制作一个从左到右顺序的两行旋转木马(也响应)
附:
$('slider').slick({
rows: 2,
slidesToShow: 3,
responsive: [
{
breakpoint: 768,
settings: {
slidesToShow: 1
}
}
]
});
Run Code Online (Sandbox Code Playgroud)
我收到这个订单:
1 3 5 7 9 11
2 4 6 8 10 12
Run Code Online (Sandbox Code Playgroud)
这个解决方案对我不利,因为我使用1张幻灯片以响应模式显示:如何创建一个包含多行的轮播?
有任何想法吗?
我需要使用 Puppeteer 获取网站保存的所有数据:cookies 和 localStorage(例如登录后)。我已阅读所有 Puppeteer 文档,但找不到有关 localStorage 的任何信息。
我可以获取 cookie,但我不知道如何获取 localStorage。例如:
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.goto('https://www.twitter.com/')
//
// code for login
//
const returnedCookie = await page.cookies();
console.log(returnedCookie)
// const localStorage = ??
// console.log(localStorage)
await browser.close()
})()
Run Code Online (Sandbox Code Playgroud) 我在Android应用中使用Firebase推送通知.我可以使用自定义图标正确发送通知,但我还没有设法播放我的自定义声音.我总是得到设备的默认声音.
{
"registration_ids": "myToken",
"notification": {
"body": "my body",
"title": "my title",
"icon": "ic_notification",
"sound": "mysound.mp3" // I tried "mysound", "mysound.wav"...
},
"priority": "high"
}
Run Code Online (Sandbox Code Playgroud)
自定义声音位于/ res/raw中
我能够使用onMessageReceived和Firebase数据消息播放自定义声音,但不能使用Firebase通知消息.
我的Android设备是小米米A1和奥利奥8.1.也尝试了与小米米A2相同的结果.
我尝试使用php和curl,使用node.js ...总是一样的问题,我得到我的默认声音.
UPDATE
使用此node.js代码也不起作用:
var registrationToken = 'xxxxxx';
var message = {
notification: {
title: 'my title',
body: 'my body',
},
android: {
ttl: 3600 * 1000,
notification: {
color: '#ff0000',
sound: 'mysound.mp3'
}
},
token: registrationToken
};
Run Code Online (Sandbox Code Playgroud) 当我做Laravel急切加载时我需要别名:
$posts = Post::with(array('images as main_image' => function($query) // do not run
{
$query->where('number', '=', '0');
}))
->where('id', '=', $id)
->get();
return Response::json($posts);
Run Code Online (Sandbox Code Playgroud)
我需要这个,因为我想要这样的JSON响应:
[
{
"id": 126,
"slug": "abc",
"name": "abc",
"created_at": "2014-08-08 08:11:25",
"updated_at": "2014-08-28 11:45:07",
"**main_image**": [
{
"id": 223,
"post_id": 126
...
}
]
}
]
Run Code Online (Sandbox Code Playgroud)
有可能的?
我有多个项目组织在多个列和行中
<div class="items">
<div class="item-1">
<div class="item-2">
<div class="item-3">
<div class="item-4">
<div class="item-5">
...
</div>
Run Code Online (Sandbox Code Playgroud)
我正在使用jQuery slidedown在点击时显示每个项目的隐藏内容.我想正确地推送底部内容,即扩展对象所属的同一列.
基本浮点示例:左和宽:33%
http://jsfiddle.net/kurtko/4w8n1frr/
我尝试了几种方法:
1)使用float:left的列,然后插入用PHP更改顺序的项目.从:1,2,3,4,5,6,7,8,9到1,4,7,2,5,8,3,6,9.
http://jsfiddle.net/kurtko/adLL8gmn/
<div class="items">
<div class="column>
<div class="item-1">
<div class="item-4">
<div class="item-7">
</div>
<div class="column>
<div class="item-2">
<div class="item-5">
<div class="item-8">
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
这是一个很好的方法,但是当我使用一列的响应版本时,顺序是不正确的.
2)砌体.Masonry - Isotope有一个名为'masonryColumnShift'的自定义布局模式,但在当前版本2中被禁用.
http://isotope.metafizzy.co/v1/custom-layout-modes/masonry-column-shift.html
3)Flexbox.使用:
http://jsfiddle.net/kurtko/7cu5jvrr/
.items {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: flex-start;
}
.item {
width: 33.3%;
}
Run Code Online (Sandbox Code Playgroud)
效果不错但不完美.当项目更改其高度时,将在该行下方创建一个空白区域.
有任何想法吗?
谢谢.
我正在尝试使用 puppeteer 搜索不区分大小写的内部文本。
我读过这个:case insensitive xpath contains() possible?
例如我有这个元素:
<div>
<span>Test One</span>
<span>Test Two</span>
<span>Test Three</span>
</div>
Run Code Online (Sandbox Code Playgroud)
我尝试过这个但不成功:
const element = await page.$x("//span//text()[contains(translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'two')]");
Run Code Online (Sandbox Code Playgroud) 看了很多关于此的帖子.我需要一个很好的方法来选择两个日期之间的事件.可能的条件如下图所示:
我的第一次尝试如下:
SELECT *
FROM events
WHERE
(
start_date BETWEEN $start_select AND $end_select
OR
end_date BETWEEN $start_select AND $end_select
)
OR
(
start_date <= $start_select
AND
end_date >= $end_select
)
Run Code Online (Sandbox Code Playgroud)
问题是进行查询需要很长时间.
然后我看到这篇文章:从两个日期之间的日期范围中选择数据,其中@dmlukichev谈到排除所有错误的选项:
像这样的东西:
SELECT *
FROM events
WHERE NOT
(
start_date < $start_select
OR
end_date > $end_select
)
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
有任何想法吗?
我需要在加载页面时将类更改为当前项.我在当前项目中显示标题.这是代码:
$(document).ready(function() {
$('#slider').on('change.owl.carousel changed.owl.carousel', function(e) {
if (e.property.name != 'position') return;
var current = e.relatedTarget.current()
var items = $(this).find('.owl-stage').children()
var add = e.type == 'changed'
items.eq(e.relatedTarget.normalize(current )).toggleClass('current', add)
});
$('#slider').owlCarousel({
items : 2,
nav: true,
loop: true,
});
})
Run Code Online (Sandbox Code Playgroud)
这里有一个工作示例:http://jsfiddle.net/kurtko/1qdurrLz/16/
此代码在轮播更改时工作正常但在页面加载时失败,因为e.relatedTarget.current()为null
有任何想法吗?
谢谢.
我需要在page.evaluatepuppeteer 中使用一个函数。我使用exposeFunction并且我需要将完整的元素发送到我的函数
我有一个简单的例子:
const puppeteer = require('puppeteer');
const myFunction = (content) => {
console.log(content.outerHTML); // empty
}
(async () => {
const browser = await puppeteer.launch()
const page = await browser.newPage()
page.on('console', msg => console.log('PAGE LOG:', msg.text()));
const url = "https://www.google.com";
await page.goto(url,{
waitUntil: 'networkidle2'
})
await page.exposeFunction('myFunction', myFunction);
const content = await page.$('.content')
await page.evaluate( (content) => {
myFunction (content); // I need to send full Element
//console.log(content.outerHTML); // here works fine
//my_function (JSON.stringify(content)); // …Run Code Online (Sandbox Code Playgroud) 我有两个div。当将元素悬停在另一个 div 内时,我想更改 div 内元素的样式。
在下一个示例中,我想显示more何时将鼠标悬停在h3
只能用css吗?
参见示例:
.alpha {
position:relative;
background-color:red;
width:100px;
height:50px;
}
.alpha .more {
position:absolute;
top:40%;
left:40%;
display:none
}
.beta {}
.beta h3:hover + .alpha .more {
display:block;
}Run Code Online (Sandbox Code Playgroud)
<div class="alpha">
<span class="more">Hello</span>
</div>
<div class="beta">
<h3>Make hover</h3>
</div>Run Code Online (Sandbox Code Playgroud)