小编Gib*_*boK的帖子

如何在包含div的ul中使用jquery索引?

使用我的代码我得到-1...我应该得到2代替.

我需要在不考虑div标签之lifocusul情况下获取类的位置<div class="clm-XXXX">

我该如何更改代码?请注意(我无法更改HTML结构).

http://jsfiddle.net/4bJtr/3/

   <div class="snippet-content">
<ul class="layout-1">
    <div class="clm-1">
        <li>content 1</li>
    </div>
    <div class="clm-1">
        <li>content 2</li>
        <li class="focus">content 3</li>
        <li>content 4</li>
        <li>content 5</li>
    </div>
    <div class="clm-3">
        <li>content 6</li>
        <li>content 7</li>
    </div>
</ul>
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

0
推荐指数
1
解决办法
56
查看次数

正则表达式,用于使用javascript在HTML中的<img>标签中查找图像URL

从图像标记中收集数组srcs网址的更快方法是什么?

var result = [];
var html= '<img src="http://mysite.com/a/b/c/images/aaa.jpg"><img src="http://mysite.com/a/b/c/images/bbb.jpg"><img src="http://mysite.com/a/b/c/images/ccc.jpg">'
Run Code Online (Sandbox Code Playgroud)

所以结果应该在数组中列出:

http://mysite.com/a/b/c/images/aaa.jpg
http://mysite.com/a/b/c/images/bbb.jpg
http://mysite.com/a/b/c/images/ccc.jpg
Run Code Online (Sandbox Code Playgroud)

javascript regex jquery

0
推荐指数
1
解决办法
641
查看次数

无法隐式转换类型'System.Collections.Generic.IEnumerable

我需要使用过滤ObservableCollection (Where(x=>x.IsMallExternal == false))

使用此代码:

ObservableCollection<Shop> test = allShopsForCat.Where(x => x.IsMallExternal == false);
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<DataModel.Shop>' to 'System.Collections.ObjectModel.ObservableCollection<DataModel.Shop>'. 
Run Code Online (Sandbox Code Playgroud)

因此,我改用此代码作为解决方案,但似乎不是最佳方法。

  • 我想知道如何.Where在我的方法中过滤ObservableCollection 。

   public ObservableCollection<Shop> Shops
        {
            get
            {
                ObservableCollection<Shop> allShopsForCat = App._dataSource.GetShopsForCategoryAll(_id);

                //ObservableCollection<Shop> test = allShopsForCat.Where(x => x.IsMallExternal == false); // THIS DOES NOT WORK
                ObservableCollection<Shop> shopsNotExternal = new ObservableCollection<Shop>();
                // Get only shops for category which are internal to mall
                foreach (var shop in allShopsForCat)
                {
                    if (shop.IsMallExternal == false)
                    {
                        shopsNotExternal.Add(shop);
                    }
                } …
Run Code Online (Sandbox Code Playgroud)

c# linq

0
推荐指数
1
解决办法
6621
查看次数

调用方法(反射)时如何传递参数?

我需要调用一个方法,传递一个 int。使用以下代码我可以获取该方法但不传递参数。如何修复它?

dynamic obj;
obj = Activator.CreateInstance(Type.GetType(String.Format("{0}.{1}", namespaceName, className)));

var method = this.obj.GetType().GetMethod(this.methodName, new Type[] { typeof(int) });
bool isValidated = method.Invoke(this.obj, new object[1]);

public void myMethod(int id)
{
}
Run Code Online (Sandbox Code Playgroud)

c# reflection

0
推荐指数
1
解决办法
435
查看次数

如何检测div或body的变化?

我有一个以下脚本,我需要检测:

  • 内容元素有变化(例如大小/位置)或
  • body元素有变化(例如大小/位置)

我不能在按钮本身上使用这个逻辑.

有什么活动?你能提供代码样本吗?

http://jsbin.com/sewerumive/1/

<!DOCTYPE html>
<html>

<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <script>
        window.App = {
            start: function () {
                var btn = document.getElementById('addContent');
                btn.addEventListener('click', function () {
                    var body = document.getElementsByTagName('body')[0];
                    body.innerHTML += '<p>ADDED LATER - Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a …
Run Code Online (Sandbox Code Playgroud)

html javascript css dojo

0
推荐指数
1
解决办法
3111
查看次数

CKFinder TypeError:t.event.special.swipe未定义

在Firefox 44.0上使用CKFinder 3.2.0时收到以下错误.它仅在Firefox上发生,在Chrome上完全正常.

知道什么可能导致它以及如何解决它?

TypeError: t.event.special.swipe is undefined
Stack trace:
CKFinder</<._setup/</<.init@https://10.10.10.20/ckfinder/ckfinder.js:8:8
CKFinder</<._setup/</<.start/</<@https://10.10.10.20/ckfinder/ckfinder.js:19:9706
newContext/y.execCb@https://10.10.10.20/ckfinder/ckfinder.js:5:26980
newContext/C.prototype.check@https://10.10.10.20/ckfinder/ckfinder.js:5:20584
newContext/C.prototype.enable@https://10.10.10.20/ckfinder/ckfinder.js:5:23528
newContext/C.prototype.init@https://10.10.10.20/ckfinder/ckfinder.js:5:19790
o/<@https://10.10.10.20/ckfinder/ckfinder.js:5:25339
setTimeout handler*CKFinder</<._setup/</</req.nextTick<@https://10.10.10.20/ckfinder/ckfinder.js:5:29067
o@https://10.10.10.20/ckfinder/ckfinder.js:5:25278
CKFinder</<._setup/</</requirejs@https://10.10.10.20/ckfinder/ckfinder.js:5:28955
CKFinder</<._setup/</<.start/<@https://10.10.10.20/ckfinder/ckfinder.js:19:9598
n.Callbacks/j@https://10.10.10.20/ckfinder/libs/jquery.js?ver=js6uhv:2:26920
n.Callbacks/k.fireWith@https://10.10.10.20/ckfinder/libs/jquery.js?ver=js6uhv:2:27738
.Deferred/</e[f[0]]@https://10.10.10.20/ckfinder/libs/jquery.js?ver=js6uhv:2:28704
CKFinder</<._setup/</r.init/<@https://10.10.10.20/ckfinder/ckfinder.js:7:29367
s@https://10.10.10.20/ckfinder/ckfinder.js:7:27199
newContext/y.execCb@https://10.10.10.20/ckfinder/ckfinder.js:5:26980
newContext/C.prototype.check@https://10.10.10.20/ckfinder/ckfinder.js:5:20584
newContext/C.prototype.enable/</<@https://10.10.10.20/ckfinder/ckfinder.js:5:23189
bind/<@https://10.10.10.20/ckfinder/ckfinder.js:5:14778
newContext/C.prototype.emit/<@https://10.10.10.20/ckfinder/ckfinder.js:5:23667
each@https://10.10.10.20/ckfinder/ckfinder.js:5:14253
newContext/C.prototype.emit@https://10.10.10.20/ckfinder/ckfinder.js:5:23635
newContext/C.prototype.check@https://10.10.10.20/ckfinder/ckfinder.js:5:21305
newContext/C.prototype.enable@https://10.10.10.20/ckfinder/ckfinder.js:5:23528
newContext/C.prototype.init@https://10.10.10.20/ckfinder/ckfinder.js:5:19790
newContext/C.prototype.callPlugin/</r<@https://10.10.10.20/ckfinder/ckfinder.js:5:22166
bind/<@https://10.10.10.20/ckfinder/ckfinder.js:5:14778
CKFinder</<._setup/</t.finishLoad@https://10.10.10.20/ckfinder/ckfinder.js:9:24377
CKFinder</<._setup/</t.load/<@https://10.10.10.20/ckfinder/ckfinder.js:9:24651
CKFinder</<._setup/</t.get/s.onreadystatechange@https://10.10.10.20/ckfinder/ckfinder.js:9:25864
EventHandlerNonNull*CKFinder</<._setup/</t.get@https://10.10.10.20/ckfinder/ckfinder.js:9:25720
CKFinder</<._setup/</t.load@https://10.10.10.20/ckfinder/ckfinder.js:9:24631
newContext/C.prototype.callPlugin/<@https://10.10.10.20/ckfinder/ckfinder.js:5:22740
bind/<@https://10.10.10.20/ckfinder/ckfinder.js:5:14778
u@https://10.10.10.20/ckfinder/ckfinder.js:5:17104
newContext/C.prototype.callPlugin@https://10.10.10.20/ckfinder/ckfinder.js:5:21493
newContext/C.prototype.fetch@https://10.10.10.20/ckfinder/ckfinder.js:5:20194
newContext/C.prototype.check@https://10.10.10.20/ckfinder/ckfinder.js:5:21399
newContext/C.prototype.enable@https://10.10.10.20/ckfinder/ckfinder.js:5:23528
newContext/y.enable@https://10.10.10.20/ckfinder/ckfinder.js:5:26027
newContext/C.prototype.enable/<@https://10.10.10.20/ckfinder/ckfinder.js:5:23388
bind/<@https://10.10.10.20/ckfinder/ckfinder.js:5:14778
each@https://10.10.10.20/ckfinder/ckfinder.js:5:14253
newContext/C.prototype.enable@https://10.10.10.20/ckfinder/ckfinder.js:5:22878
newContext/C.prototype.init@https://10.10.10.20/ckfinder/ckfinder.js:5:19790
o/<@https://10.10.10.20/ckfinder/ckfinder.js:5:25339
setTimeout handler*CKFinder</<._setup/</</req.nextTick<@https://10.10.10.20/ckfinder/ckfinder.js:5:29067
o@https://10.10.10.20/ckfinder/ckfinder.js:5:25278
CKFinder</<._setup/</</requirejs@https://10.10.10.20/ckfinder/ckfinder.js:5:28955
i@https://10.10.10.20/ckfinder/ckfinder.js:7:27411
CKFinder</<._setup/</r.init@https://10.10.10.20/ckfinder/ckfinder.js:7:27819
CKFinder</<._setup/</<.start@https://10.10.10.20/ckfinder/ckfinder.js:19:9399
o/<@https://10.10.10.20/ckfinder/ckfinder.js:19:12310
newContext/y.execCb@https://10.10.10.20/ckfinder/ckfinder.js:5:26980
newContext/C.prototype.check@https://10.10.10.20/ckfinder/ckfinder.js:5:20584
newContext/C.prototype.enable/</<@https://10.10.10.20/ckfinder/ckfinder.js:5:23189
bind/<@https://10.10.10.20/ckfinder/ckfinder.js:5:14778
newContext/C.prototype.emit/<@https://10.10.10.20/ckfinder/ckfinder.js:5:23667
each@https://10.10.10.20/ckfinder/ckfinder.js:5:14253
newContext/C.prototype.emit@https://10.10.10.20/ckfinder/ckfinder.js:5:23635
newContext/C.prototype.check@https://10.10.10.20/ckfinder/ckfinder.js:5:21305
newContext/C.prototype.enable/</<@https://10.10.10.20/ckfinder/ckfinder.js:5:23189
bind/<@https://10.10.10.20/ckfinder/ckfinder.js:5:14778
newContext/C.prototype.emit/<@https://10.10.10.20/ckfinder/ckfinder.js:5:23667
each@https://10.10.10.20/ckfinder/ckfinder.js:5:14253
newContext/C.prototype.emit@https://10.10.10.20/ckfinder/ckfinder.js:5:23635
newContext/C.prototype.check@https://10.10.10.20/ckfinder/ckfinder.js:5:21305 …
Run Code Online (Sandbox Code Playgroud)

javascript jquery ckeditor ckfinder jquery-mobile

0
推荐指数
1
解决办法
202
查看次数

在没有我调用 setState 的情况下反应状态更新?

我正在使用 React 制作一个待办事项列表应用程序。我的状态有项目,也有删除的项目,以便它们可以恢复:

  state = {
    items: ['item 1', 'item 2', 'item 3'],
    deletedItems: ['item 4', 'item 5']
  };
Run Code Online (Sandbox Code Playgroud)

因此,我删除项目的功能必须从项目状态中删除项目并将其放入删除的项目状态。

 removeItem(number) {
    const itemsState = this.state.items;
    const deletedItemsState = this.state.deletedItems;

    const itemToBeDeleted = itemsState[number];
    deletedItemsState.push(itemToBeDeleted);

    itemsState.splice(number, 1);
    this.setState({ items: itemsState });
  }
Run Code Online (Sandbox Code Playgroud)

上面的代码有效,但我很困惑为什么我没有调用 setState 就更新了 DeletedItems 状态。我在这里没有遵循最佳实践吗?

reactjs

0
推荐指数
1
解决办法
1753
查看次数

PHP 5是面向对象的吗?

我想知道PHP是否面向对象,我从版本5读到PHP现在支持OOP世界的功能.这意味着PHP现在变成了完整的OO语言?

您对在PHP上使用OO Style进行开发有任何反馈吗?

(注意:我没有使用PHP只有C#的经验).

php php-5.3

-2
推荐指数
1
解决办法
2476
查看次数

标签 统计

javascript ×4

jquery ×3

c# ×2

html ×2

ckeditor ×1

ckfinder ×1

css ×1

dojo ×1

jquery-mobile ×1

linq ×1

php ×1

php-5.3 ×1

reactjs ×1

reflection ×1

regex ×1