我意识到这个问题之前已被问过,但我无法深究它.
这是我的图表... http://www.gogeye.com/financialnews/piechart/index3.html
我想做的就是在图表后面有硬币渲染.我知道D3渲染它们是为了附加它们.
我试图重新附加硬币,但似乎无法让它工作.
我已经尝试重新排序,当事情被附加在DOM中,但可能因为变量在被定义之前被调用而不断出错.
有人能举例说明如何用我的代码解决这个问题吗?我不希望你为我做这项工作,但我已经把头发拉了很长时间,我似乎无法将其他人的例子用于我的.
谢谢
我认为应该正常工作的代码非常简单.稍微混淆为什么不是.
我有一个带有'右'类的箭头,当你点击它时,年变量会上升.当达到某一年时,这个div也会被赋予"死"类,我希望它能够杀死click函数,所以我添加了"not"选择器作为click函数的条件.但是,当您单击按钮时,年份将继续增加.
有任何想法吗?
$('.right').not('.dead').click(function(){
year += 1;
console.log(year);
if (year === 2015){
$(this).addClass('dead');
}
});
Run Code Online (Sandbox Code Playgroud) 这是一个非常基本的问题.我有这个代码块,我认为它可以,但它抛出一个错误......
Uncaught TypeError: undefined is not a function
Run Code Online (Sandbox Code Playgroud)
这是有问题的代码
$('.colourbox').each(function(i){
// select visible children
var visibleDivs = $(this).children('div').length;
// use whatever width calculation you'd like...
var targetWidth = 300 / visibleDivs.length - 1;
// apply the width to the divs
visibleDivs.width(targetWidth);
});
Run Code Online (Sandbox Code Playgroud)
谢谢