图像不显示在iPad d3js
Image not showing on iPad d3js
我在iPad web应用中使用d3js和AngularJS。当在Safari/Chrome上运行时,一切看起来都很好,但在iPad上运行时,我用d3js附加的图像不显示。
这是我的JS:
directive('zoomScreen', [function() {
return{
restrict: 'E',
link: function(scope, elm, attrs) {
var width = 1024,
height = 660;
var offset= [{"xoff":-20,"yoff":10,"swipe_class":"left"},{"xoff":-80,"yoff":0,"swipe_class":"right"},{"xoff":0,"yoff":-80,"swipe_class":"left"},{"xoff":50,"yoff":0,"swipe_class":"left"}];
var svg = d3.select("svg")
.attr("width", width)
.attr("height", height)
.append("g");
var back = svg.append("image")
.attr("class", "logo")
.attr("x", 375)
.attr("y", 175)
.attr("xlink:href", "../images/brain-back.png")
.attr("height", 300)
.attr("width", 300)
.style("fill", "transparent")
.style("stroke", "black")
.style("stroke-width", 1)
.on("click", outClicked);
var image = svg.append("image")
.attr("class", "logo")
.data([offset[0]])
.attr("x", 485)
.attr("y", 175)
.attr("height", 90).attr("width", 90)
.attr("xlink:href", "../images/image1.png")
.style("stroke", "black")
.style("stroke-width", 1)
.on("click", clicked);
var image2 = svg.append("image")
.attr("class", "logo")
.data([offset[1]])
.attr("x", 545)
.attr("y", 255)
.attr("height", 90).attr("width", 90)
.attr("xlink:href", "../images/image2.png")
.style("stroke", "black")
.style("stroke-width", 1)
.on("click", clicked);
我的HTML:
<zoom-screen>
<svg class="accel"></svg>
</zoom-screen>
奇怪的是iPad知道那里有元素,因为它允许我高亮显示并点击它们,但它不显示图像
我所要做的就是将图像转换为64进制字符串。所以我只是将字符串设置为var,并让我的xlink:href指向var而不是位置。例:
var image1 = "data:foobase64stringhere";
.attr('xlink:href',image1)
相关文章:
- HTML5音频加载和播放获胜'我不能在iPad上工作
- 对iPad上的点击事件反应缓慢
- d3js文本传输-示例代码不起作用
- jQuery(this).Pparent().Pparente().Prent().find()在iPad上不起作用
- iPad没有加载所有HTML5元素
- iPad虚拟键盘-哪一个-javasctript解决方案
- 提供“;onClick"适用于iPad(触摸屏)和桌面用户的默认功能
- 如何操作d3js树布局
- 防止在移动Safari(iPad/iPhone)中长按/长按默认上下文菜单
- D3JS selectAll to append rect
- Javascript-iPad Tab键检测,带蓝牙键盘
- D3js如何在.enter上下文中在同一级别附加两个子级
- 应用了转换时的D3js排序问题
- 在iPad上查看时忽略CSS
- jquery scrollTO iPhone/iPad没有't向右滚动
- mootools点击:继电器没有在ipad/iphone上启动
- d3js/没有固定坐标的多边形
- 如何在d3js中突出显示重叠的between矩形
- 无法延迟iPhone/iPad上的两个JavaScript操作
- 图像不显示在iPad d3js