我有一个网站运行一些JavaScript.仅在IE8中,使用或不使用鼠标滚轮滚动时,$(文档).scroll不会触发.以下代码段:
$(document).scroll(function () {
//do something on scroll
});
Run Code Online (Sandbox Code Playgroud)
有没有特定的原因这个功能不会在IE8中触发?我在线搜索没有成功.
感谢所有的建议和提示!!!!!
我有一个map对象,它存储<Id, String>Id是联系人ID的位置,String是生成的电子邮件消息.
我已成功遍历地图,并且能够在迭代地图时拉出值(字符串部分).
我想要做的就是在抓住价值时抓住钥匙.这在大多数语言中都很简单,但我似乎无法找到如何在顶点执行此操作.
这就是我现在所拥有的:
Map<Id,String> mailContainer = new Map<Id,String>{};
for(String message : mailContainer.values())
{
// This will return my message as desired
System.debug(message);
}
Run Code Online (Sandbox Code Playgroud)
我想要的是这样的:
for(String key=>message : mailContainer.values())
{
// This will return the contact Id
System.debug(key);
// This will return the message
System.debug(message);
}
Run Code Online (Sandbox Code Playgroud)
提前致谢!
我正在使用PHP 5.3和extract()函数.
这是我正在构建的类的一个简单示例:
private api_username;
private api_password;
private api_signature;
private version = '63.0';
public function __construct($credentials) {
extract($credentials);
$this->api_username = $api_username;
}
Run Code Online (Sandbox Code Playgroud)
问题是在提取之后,我必须逐个通过变量并将它们分配给类变量.
有没有办法直接提取到类变量,所以我不必逐项分配?
我有一个简单的触发器,它从引导对象中提取数据,并在创建或更新引导时将其放入自定义的"财务"对象中.由于某种原因,Trigger.new [i] .Id在触发器中返回NULL,在插入之前触发.
我疯了,因为我看不出为什么Id会为NULL的原因......这是我的代码:
trigger FinanceNew on Lead (before insert) {
Map<String,User> userList = new Map<String,User>{};
// Places each returned user into a map with their sfID as the key
for(User tmp : [SELECT Id,Name,Email,Phone FROM User]){
userList.put(tmp.Id,tmp);
}
for(integer i = 0; i<Trigger.new.size(); i++){
string leadName = null;
if(Trigger.new[i].FirstName != ''){
leadName = Trigger.new[i].FirstName + ' ' + Trigger.new[i].LastName;
}else{
leadName = Trigger.new[i].LastName;
}
User ownerInfo = userList.get(Trigger.new[i].OwnerId);
ID leadId = Trigger.new[i].Id; // THIS IS RETURNING NULL!!
Finance__c financeRecord …Run Code Online (Sandbox Code Playgroud) 我正在使用jQuery .animate()创建一个无限的轮播.我以前用过.animate()没有任何问题.但是,这次动画没有完成.
这是一个非常简单的动画,改变margin-left为不同的值.值会发生变化,对我而言,它看起来好像已经完成,但函数不会触发.
这是我的代码:
<script type="text/javascript">
$("#scrollLeft").click(function(){
$("#scrollContent").animate(
{'margin-left':'-714px'},
{queue:false, duration:500},
function(){
alert("finishedLeft");
});
});
$("#scrollRight").click(function(){
$("#scrollContent").animate(
{'margin-left':'-1190px'},
{queue:false, duration:500},
function(){
alert("finishedRight");
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
问题区域是页面底部的轮播.我正在逃跑jquery-1.7.1.min.js.
我想我的主要问题是,即使看起来事件已经完成,有什么可能阻止此功能被触发?
我遇到一个问题,jQuery.InArray()当我运行一个函数时返回-1,但我知道我正在测试的值肯定在数组中.
我知道它们在数组中,因为如果我在运行jQuery.inArray()值存在并显示之前就调试数组的值.以下是我正在使用的示例:
/* -- In page.php -- */
images = [8, 13, 21, 32, 40, 56];
/* -- In script.js -- */
console.log('images->', images);
//output images-> [8, 13, 21, 32, 40, 56]
var testingValue = 13;
console.log('inArray->', jQuery.inArray(testingValue, images)); //Should return 1
//output inArray-> -1
console.log('inArray->', jQuery.inArray(13, images)); //Should return 1
//output inArray-> -1
console.log('inArray->', jQuery.inArray("13", images)); //Should return -1
//output inArray-> -1
console.log('inArray->', jQuery.inArray('13', images)); //Should return -1
//output inArray-> -1
Run Code Online (Sandbox Code Playgroud)
所有这些都返回,-1即使前两个应该返回1 …
我有一个php类Assets.在内部Assets有各种处理资产的公共功能(缓存,缩小,组合......).其中一个公共函数包含执行a所需的辅助函数preg_replace_callback().这个内部函数需要访问其他一个公共函数,但我无法调用其他函数.
这是设置:
class Assets
{
public function img($file)
{
$image['location'] = $this->image_dir.$file;
$image['content'] = file_get_contents($image['location']);
$image['hash'] = md5($image['content']);
$image['fileInfo'] = pathinfo($image['location']);
return $this->cache('img',$image);
}
public function css($content)
{
. . .
function parseCSS($matched){
return $this->img($matched); // THIS LINE NEEDS TO REFERENCE function img()
}
$mend = preg_replace_callback(
'#\<parse\>(.+?)\<\/parse\>#i',
'parseCSS',
$this->combined_css
);
. . .
}
}
Run Code Online (Sandbox Code Playgroud)
这是我尝试过的:
$this->img($matched)错误:不在对象上下文中时使用$ this - 引用
$this->内部parseCSS()
Assets::img($matched)错误:不在对象上下文中时使用$ this - 引用
$this->内部img()
那么, …
我一直在摆弄这个问题已经有一段时间了,我正处于挫折之中.我正在使用MY_Controller扩展控制器类.
以下是详细信息:
__construct() 似乎没有被称为.MY_设置为扩展的前缀(我有其他扩展工作正常)这是我的代码:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Controller extends CI_Controller {
function __construct()
{
parent::__construct();
echo 'TESTING!!!'; // This should print, followed by an ob_start() error
}
}
Run Code Online (Sandbox Code Playgroud)
我应该得到一个页面,TESTING!!!后面跟着一个ob_start()错误,但是页面正常渲染.
我试过拆分构造函数类并只调用MY_Controller中的私有函数,但这不起作用.我知道正在调用该文件,因为如果我故意在MY_Controller.php中创建一个php错误,该页面将会出错.在我看来,它__construct()只是没有运行.
jquery ×3
php ×3
apex-code ×2
javascript ×2
salesforce ×2
arrays ×1
codeigniter ×1
constructor ×1
extend ×1
for-loop ×1
function ×1
key ×1
scope ×1
scroll ×1