我有一个Angular应用程序的问题.
我有一个包含langs短代码的数组('en','fr',...).基本上,我希望Angular在该数组上循环,并对每个值进行HTTP get请求.
for (var i in $scope.langs) {
console.log($scope.langs[i].shortName);
$http.get($scope.appURL + $scope.langs[i].shortName + '/api/products/?format=json&resto='+ $scope.restoID)
.then(function(res){
$scope.products = angular.fromJson(res.data);
window.localStorage.setItem("products-"+$scope.langs[i].shortName, JSON.stringify(res.data));
$scope.products = JSON.parse(window.localStorage.getItem("products-"+$scope.langs[i].shortName));
console.log('LANG = '+ $scope.langs[i].shortName, $scope.products);
});
}
Run Code Online (Sandbox Code Playgroud)
第一个日志显示:
fr
en
Run Code Online (Sandbox Code Playgroud)
好极了!最后一个日志被抛出两次(我的数组中有2个langs),也很棒.
问题是在循环中,日志在两种情况下显示相同的语言,当我应该有一个fr/api/...和一个en/api/...它总是记录2 en/api/...
我不知道它是否清楚......有什么想法吗?
我正在尝试span使用contenteditable=true属性收听焦点/模糊事件.
所以这就是我尝试过的(jQuery):
$('.editable').on('focus',function(){
var that = $(this),
defaultTxt = that.data('default');
that.html('');
});
$('.editable').on('blur',function(){
var that = $(this),
defaultTxt = that.data('default');
if(that.html() === ''){
that.html(defaultTxt);
}
});
Run Code Online (Sandbox Code Playgroud)
但他似乎没有工作,因为span不能处理焦点/模糊.我怎么能实现这一点(需要IE8支持)?
我正在尝试用qTranslate X制作一个基本的语言切换器,例如:
FR | EN
Run Code Online (Sandbox Code Playgroud)
有一个功能可以实现:qtranxf_generateLanguageSelectCode('text');但它只能接受'text','image'或'both',所以它不符合我的需要:'text'是语言的全名.
我怎样才能显示语言代码?有没有想过制作过滤器来做到这一点?
我目前正在尝试使用PHP获取图像的宽高比.例如,使用这些值:
$thumb_width = 912;
$thumb_height = 608;
Run Code Online (Sandbox Code Playgroud)
我可以得到纵横比(16:9,3:2,2:3等).所以在这种情况下:
$ratio = '3:2';
Run Code Online (Sandbox Code Playgroud)
问题是:我不知道它的新宽度或高度.所以我不能做那样的事情:(original height / original width) x new width = new height
有任何想法吗 ?
注意:我不想调整图像大小,只需计算其宽高比和宽高比.
我需要重现与此处相同的效果:http://www.chanel.com/fr_FR/mode/haute-couture.html =对鼠标移动事件的滑动效果.
我只需要动画部分的一些帮助.
function frame() {
$('.images-gallery').css({
'transform': 'translateX('+ -mouseXPerc +'%)'
});
requestAnimationFrame(frame);
}
requestAnimationFrame(frame);
$(document).on('mousemove',function(e){
mouseXPerc = e.pageX/containerWidth*100;
});
Run Code Online (Sandbox Code Playgroud)
这是我到目前为止所做的.它的工作原理,但你可以想象,它是非常原始的,我需要一些缓和.如何编辑我frame() function以使事情变得更顺畅?
编辑:我不能使用CSS转换/动画,因为我更改requestAnimationFrame上的值(每1/30秒).
我最近打开了一些我必须开发的移动应用程序模型。我正在使用 React Native(带有 Expo)。问题是,这个模型使用了大量 Adobe 字体 (Typekit)。
我遇到了文档: https: //helpx.adobe.com/fonts/using/embed-codes.html,它可以在网络应用程序上使用,而不是在编译的移动应用程序上使用。
我找不到任何相关问题,但我想知道移动应用程序开发人员如何在他们的项目中实现 Typekit 字体?
我试图在循环中检查我的帖子是否有内容.目前,我在循环中添加了一个条件:
if ( $post->post_content )
Run Code Online (Sandbox Code Playgroud)
和推论的论点
wp query ('posts_per_page' => 8).
Run Code Online (Sandbox Code Playgroud)
我认为它有效,但实际上,WP query去找最后8 posts,检查那些内容8 lasts.所以它呈现2或3发布.
我想要的是一种显示8有内容的帖子的方法.
明白了吗 ?
我真的很感激一些帮助:)
最好的祝福.
我想这个问题已被问过十亿次,但只是另一个案例.
如何使用HTML/CSS(如果没有其他选项,JS - 我正在考虑画布或SVG):
注意:div应该能够在整个绿色部分包含滚动背景图像.这应该适用于IE9 +和常见的移动设备(默认浏览器).此外,形状周围的空间需要保持透明(不能使用白色元素来创建圆形形状)
什么是更好的选择?
我目前能够使用这种类型的请求(使用PHP)获取FB页面提要:
https://graph.facebook.com/{$id}/feed?{$authentication}&limit={$maximum}
Run Code Online (Sandbox Code Playgroud)
它给了我FB页面的最后帖子,包含消息和发布日期.我只想检索此内容+每个帖子图片(如果至少有一个).
所以我做了这个请求:
https://graph.facebook.com/{$feed}/feed?{$authentication}&fields=attachments&limit={$maximum}
Run Code Online (Sandbox Code Playgroud)
哪个检索内容(文本)+图片.但那里没有约会......
检索包含内容文本,图像和发布日期的页面Feed的最佳方法是什么?
我正在使用Three.js进行基本的3D圆柱体渲染。我正在使用TextureLoader加载纹理异步(基于UI交互)。一切都很好,但我希望不要将这些纹理应用于圆柱体顶部/底部。
我该如何实现?
到目前为止,这是我所做的:
function threeJsRenderer() {
var width = 325;
var height = 375;
var scene = new THREE.Scene();
var camera = new THREE.OrthographicCamera(width / - 2, width / 2, height / 2, height / - 2, -200, 1000);
var renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
renderer.setClearColor( 0x000000, 0 );
renderer.setSize(width,height);
document.getElementById('projection').appendChild(renderer.domElement);
// CylinderGeometry(radiusTop : Float, radiusBottom : Float, height : Float, radialSegments : Integer, heightSegments : Integer, openEnded : Boolean, thetaStart : Float, thetaLength : Float) …Run Code Online (Sandbox Code Playgroud) 这是我的问题.我有一个像这样的JSON文件:
[
{
"projectName": "test",
"clientName": "test2",
"dateValid": "2014-04-18",
"account": {
"accountAmount": null,
"accountDate": "2014-04-19",
"accountType": null
},
"total": {
"totalAmount": null,
"totalDate": "2014-04-18",
"totalType": null
}
}]
Run Code Online (Sandbox Code Playgroud)
我希望PHP打开这个文件并添加另一个对象,所以我的文件将如下所示:
[
{
"projectName": "test",
"clientName": "test2",
"dateValid": "2014-04-18",
"account": {
"accountAmount": null,
"accountDate": "2014-04-19",
"accountType": null
},
"total": {
"totalAmount": null,
"totalDate": "2014-04-18",
"totalType": null
}
},
{
"projectName": "test",
"clientName": "test2",
"dateValid": "2014-04-18",
"account": {
"accountAmount": null,
"accountDate": "2014-04-19",
"accountType": null
},
"total": {
"totalAmount": null,
"totalDate": "2014-04-18",
"totalType": null …Run Code Online (Sandbox Code Playgroud) 这是我的问题:我有一个大表单,我想在其中执行 e2e 测试。当用户更改其字段中的值时,此表单会填充 URL 查询参数。
当我使用 Cypress 来检查它时,每次在表单中输入内容时,它都会生成大量日志(例如(新 URL)见下文),使得测试难以阅读。
http://localhost:3000/demande-immersion?email=&firstName=Archib&lastName=&phone=&financiaryHelp=&emergencyContact=&emergencyContactPhone=&birthdate=&agencyDepartment=86&siret=&businessName=&businessAdvantages=&etFirstName=&etLastName=&etJob=&etPhone=&etEmail=&erFirstName=&erLastName=&erPhone=&erEmail=&immersionAddress=&agencyId=1411b4b7-a7a8-4d69-92ac-1eca1ac75c50&immersionActivities=&immersionSkills=&sanitaryPreventionDescription=&workConditions=&dateStart=2023-04-27&dateEnd=2023-04-28&schedule=%7B%22totalHours%22%3A14%2C%22workedDays%22%3A2%2C%22isSimple%22%3Atrue%2C%22selectedIndex%22%3A0%2C%22complexSchedule%22%3A%5B%7B%22date%22%3A%222023-04-27T00%3A00%3A00.000Z%22%2C%22timePeriods%22%3A%5B%7B%22start%22%3A%2208%3A00%22%2C%22end%22%3A%2212%3A00%22%7D%2C%7B%22start%22%3A%2213%3A00%22%2C%22end%22%3A%2216%3A00%22%7D%5D%7D%2C%7B%22date%22%3A%222023-04-28T00%3A00%3A00.000Z%22%2C%22timePeriods%22%3A%5B%7B%22start%22%3A%2208%3A00%22%2C%22end%22%3A%2212%3A00%22%7D%2C%7B%22start%22%3A%2213%3A00%22%2C%22end%22%3A%2216%3A00%22%7D%5D%7D%5D%7D
Run Code Online (Sandbox Code Playgroud)
有没有办法过滤 Cypress 登录应用程序的事件(使用cypress open)?
javascript ×4
php ×4
html ×2
jquery ×2
wordpress ×2
adobe ×1
android ×1
angularjs ×1
animation ×1
css ×1
css-shapes ×1
cypress ×1
easing ×1
ios ×1
json ×1
qtranslate-x ×1
react-native ×1
three.js ×1
typekit ×1