小编JP1*_*971的帖子

重新定位Jquery UI自动完成结果框

我使用Jquery UI自动完成插件作为直接搜索术语建议工具.它启动并运行没有问题,除了我无法移动结果框.我基本上需要向左移动20个像素,向下移动4个像素.我试图覆盖Jquery UI CSS,但无法重新定位该框.

任何有此问题经验的人的帮助将不胜感激.

css jquery jquery-ui autocomplete jquery-plugins

23
推荐指数
3
解决办法
3万
查看次数

如何添加重定向到另一个域的Magento top.links的链接?

我可以使用以下代码将自定义链接添加到Magento的top.links中.我保存在../myCustomTheme/layout/local.xml中

<reference name="root">
<reference name="top.links">
    <action method="addLink" translate="label title">
        <label>example</label>
        <url>example</url> 
        <title>example</title>
        <prepare>true</prepare> 
        <urlParams helper="core/url/getHomeUrl"/> 
        <position>100</position>
        <liParams/>
        <aParams>class="top-link-example"</aParams>
        <beforeText></beforeText>
        <afterText></afterText>
    </action>
</reference>
</reference>
Run Code Online (Sandbox Code Playgroud)

上面的代码将创建一个名为example的链接,指向http://myexampledomain.com/example.如果我改变这行代码

<url>example</url>
Run Code Online (Sandbox Code Playgroud)

<url>http://myotherexampledomain.com</url>
Run Code Online (Sandbox Code Playgroud)

我最终得到了一个名为example的链接,指向http://myexampledomain.com/http:/myotherexampledomain.com.我已经尝试将prepare参数设置为false并通过查看../app/code/core/Mage/Core/Model/Url.php将各种参数添加到urlParams无效.

magento magento-1.4

8
推荐指数
1
解决办法
1万
查看次数

使用JavaScript替换方法保留大小写/大小写

我正在使用Jquery UI继续研究搜索术语建议工具.我现在正在使用粗体显示搜索项模式的结果.我通过修补Autocomplete的_renderItem方法实现了这个功能.我现在遇到的问题是被替换的字符具有与用户在输入中键入的字符相同的情况(例如,如果用户键入"A"并且返回的结果是"America",则替换的文本将是A meric A这是代码:

    var exp = new RegExp(this.term, "gi") ;
    var rep = item.label.replace( exp, "<span style='font-weight:bold;color:Black;'>"
    + this.term + "</span>");
Run Code Online (Sandbox Code Playgroud)

一如既往,提前感谢任何帮助.

javascript regex replace

4
推荐指数
1
解决办法
1653
查看次数

在多维数组上使用preg_match返回键值数组

我有一个结构如下的数组:

$data = array(
    "abc"=>array(
            "label" => "abc",
            "value" => "def",
            "type" => "ghi",
            "desc" => "jkl",
            ),
    "def"=>array(
            "label" => "mno",
            "value" => "qrs",
            "type" => "tuv",
            "desc" => "wxyz",
            ),
    );
Run Code Online (Sandbox Code Playgroud)

我想使用带有foreach循环的preg_match来对$ data中包含的数组执行搜索,并返回键值对的嵌套数组.

php foreach key-value preg-match

3
推荐指数
2
解决办法
7719
查看次数

如何为UIImageView实现对齐网格功能?

我有一个可拖动的视图,我已使用以下代码设置:

#import <UIKit/UIKit.h>

@interface DraggableView : UIImageView {

    CGPoint startLocation;
}

@end

#import "DraggableView.h"

@implementation DraggableView

- (id) initWithImage: (UIImage *) anImage
{
    if (self = [super initWithImage:anImage])
        self.userInteractionEnabled = YES;
    return self;
}

- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{
    // Calculate and store offset, and pop view into front if needed
    CGPoint pt = [[touches anyObject] locationInView:self];
    startLocation = pt;
    [[self superview] bringSubviewToFront:self];
}

- (void) touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event
{
    // Calculate offset
    CGPoint pt = [[touches anyObject] locationInView:self];
    float dx …
Run Code Online (Sandbox Code Playgroud)

objective-c draggable uiimageview ios4

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

GET/POST请求表单提交上缺少参数

这个让我发疯.我尝试了几种不同的解决方案无济于事.基本上发生的事情是,当我提交表单时,请求是在没有参数的情况下发送的.我已尝试POST和GET,并使用Firebug监控请求.这是一些示例代码:

<form action="/year/" id="year-form" method="get">
    <select class="dropdown" id="year" onchange="this.form.submit()">
        <option value="all">All</option>
        <option value="2011">2011</option>
        <option value="2010">2010</option>
        <option value="2009">2009</option>
    </select> 
</form>
Run Code Online (Sandbox Code Playgroud)

也许我应该注意到这是在基于WordPress的网站上,我正在将请求发回到它所来自的页面.任何有关这方面的见解将不胜感激.

php post get

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