我在我的页面上使用了以下jQuery代码,并且chrome上的一切正常.但是当我在firefox中打开相应的页面时,我得到了无响应的脚本错误.
我知道根据DOM3规范,变异事件已被弃用.但是,如果有人能帮助我在这里,我将被迫.
jQuery('#term').on("DOMSubtreeModified",function(){
$("#term > .click-slide").click(function(){
$(this).siblings().slideToggle();
});
});
Run Code Online (Sandbox Code Playgroud)
各自的HTML是:
<div class="btn-slide" id="term">
<div class="click-slide">
<button>Search Terms </button>
</div>
<div class="btn-box">
<label><span>Novena</span></label>
</div>
</div>
Run Code Online (Sandbox Code Playgroud) 我刚刚遇到这个问题
click锚标记上的触发事件在这里不起作用.
<a class="button2" href="#popup1">hello</a>
<div id="popup1" class="overlay">
<div class="popup">
<div class="contentSpec">
<h2>Would you like to visit</h2>
<h1>someURL</h1>
</div>
<a class="close" href="#"></a>
<div class="content">
<div class="box">
<a class="button" href="#popup1">YES</a>
<a class="button1" href="#popup1">NO</a>
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
JS:
$(document).ready(function() {
$(".button2").trigger('click');
});
Run Code Online (Sandbox Code Playgroud)
我的问题是,为什么触发事件在这种情况下不起作用?
我的Html:
<div class="graph-display" ng-controller="jsonServerBox">
<div class="bar-chart-box" ng-repeat="module in ocw.modules">
<canvas class="chart chart-bar" data="{{module.data}}" labels="{{module.labels}}" series="{{module.series}}"></canvas>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我的JS:
app.controller('jsonServerBox', function($scope, $http) {
var json = $http.get('serverbox.json').then(function(res){
return res.data;
});
$scope.ocw = json;
});
Run Code Online (Sandbox Code Playgroud)
图表没有显示,不知道为什么?我也没有在控制台中出现任何错误.
更新:我的JSON文件内容
[{"modules":[
{
"series":"SeriesA",
"data":["90", "99", "80", "91", "76", "75", "60", "67", "59", "55"],
"labels":["01", "02", "03", "04", "05", "06", "07","08","09","10"]
},
{
"series":"SeriesB",
"data":["90", "99", "80", "91", "76", "75", "60", "67", "59", "55"],
"labels":["01", "02", "03", "04", "05", "06", "07","08","09","10"]
}
]}
]
Run Code Online (Sandbox Code Playgroud)
控制台日志:
modules: …Run Code Online (Sandbox Code Playgroud) 有关说明,有两页:
index.html (在此页面的帮助下,弹出窗口中的下一个按钮,我将遍历下面提到的第二页)
product_detail.html (从此页面如果我想使用prev按钮返回index.html,弹出窗口关闭,没有任何反应)
custom.js的内容:
var tour = new Tour({
storage : false,
steps: [
{
element: "#ture-one",
title: "",
placement: "bottom",
content: "<p>This is the Deployment Manager Dashboard.</p><p>It shows you which versions of your software are deployed to your different environments.</p>"
},
{
element: "#ture-two",
title: "",
placement: "bottom",
content: "<p>This is the Deployment Manager Dashboard.</p><p>It shows you which versions of your software are deployed to your different environments.</p>"
},
{
element: "#ture-three",
title: "",
placement: "bottom",
content: …Run Code Online (Sandbox Code Playgroud)