我正在使用hammer.js作为网站的触摸菜单,并获得:
"对象不支持属性或方法'addEventListener'"hammer.js,第247行第13个字符
用IE8.
来自hammer.js的实际代码不起作用:
/**
* simple addEventListener
* @param {HTMLElement} element
* @param {String} type
* @param {Function} handler
*/
bindDom: function(element, type, handler) {
var types = type.split(' ');
for(var t=0; t<types.length; t++) {
element.addEventListener(types[t], handler, false);
}
},
Run Code Online (Sandbox Code Playgroud)
知道如何解决这个问题吗?
Jquery曾经有过类似的问题:http: //bugs.jquery.com/ticket/11127
我需要将data-ajax ="false"属性传递给表单.jQuery Mobile需要此属性才能使其停止使用Ajax加载页面.
这是我的代码:
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'login-form',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
'focus'=>array($model,'username'),
'data-ajax'=>false,
)); ?>
......
<?php $this->endWidget(); ?>
</div><!-- form -->
Run Code Online (Sandbox Code Playgroud)
所以我的html输出看起来像这样:
<form id="login-form" method="post" action="/*********" data-ajax ="false">
Run Code Online (Sandbox Code Playgroud)
不幸的是,我得到一个CException"属性"CActiveForm.data-ajax"没有定义." 错误.我错过了什么吗?
嘿伙计们我正在使用Fabric.js的应用程序.
Fabric.js API:http://fabricjs.com/docs/symbols/fabric.Object.html
我需要能够改变我作为背景设置的矩形的填充.
我使用canvas.getActiveObject()来改变矩形的填充.不幸的是,我似乎无法找到一个方法来改变矩形的填充.
这是我的代码:
<html>
<head>
<title>Text Rendering Example</title>
<script src="fabric.js"></script>
<script src="canvas2image.js"></script>
<script src="base64.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
</head>
<body>
<canvas id="canvas" width="1000" height="600" style="border:1px solid #000000"></canvas>
<form name = "boxForm" onsubmit="addBox()">
Width: <input type="text" name="firstname" /><br />
Text: <input id="text-control" type="text" name="textString" />
Text Color: <input id="text-color" type="text" value = "#FF0000" name="textColor" />
Background Color: <input id="background-color" type="text" value = "#333333" name="backgroundColor" />
</form>
<button onclick="addBox()">Background</button>
<button onclick="addText()">Add Text</button>
<!--button …Run Code Online (Sandbox Code Playgroud) 我试图Slick.js在触发断点时启动一个事件。即使没有命中断点
,init事件也会被触发。
有办法解决吗?
这是我的代码:
var $j = jQuery.noConflict();
$j(".homepage_slider").slick({
dots: false,
infinite: true,
arrows:false,
autoplay:true,
autoplaySpeed:3500,
slidesToShow: 1,
slidesToScroll: 1,
responsive: [
{
breakpoint: 480,
settings: {
init: changeImages()
}
}
]
});
function changeImages(){
$j('img.slider-image').each(function() {
$j(this).attr('src', $j(this).attr('data-mobile'));
});
}
Run Code Online (Sandbox Code Playgroud)
我也试过这个,但没有用:
$j('.homepage_slider').on('breakpoint', function(){
console.log("test");
$j('img.slider-image').each(function() {
$j(this).attr('src', $j(this).attr('data-mobile'));
});
});
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
更新:
找到这篇文章:如何在响应式设计中调用不同的 jquery 动作
var isBreakPoint = function (bp) {
var bps = [320, 480, 768, 1024],
w = $j(window).width(),
min, max …Run Code Online (Sandbox Code Playgroud)