How to use offsetY method in storybook-root

Best JavaScript code snippet using storybook-root

full.js

Source:full.js Github

copy

Full Screen

1/* global $, d3 */2/* global tab7content, tab10_1_1content, tab10_1_2content, tab10_1_2contenttp,3tab10_1_3content, tab10_1_3contenttp, tab10_1_4content, tab10_2_1content,4tab10_2_2content, tab10_2_3content, tab10_2_3contenttp, tab10_2_4content,5tab13_1content, tab13_1contenttp, tab13_2content, tab13_3content,6tab13_3contenttp, tab13_4content, tab14_1_1content, tab14_1_1contenttp,7tab14_1_2content, tab14_1_3content, tab14_1_4content, tab14_1_4contenttp,8tab14_2_1content, tab14_2_1contenttp, tab14_2_2content, tab14_2_3content,9tab14_2_4content, tab14_2_4contenttp, tab16_1_1content, tab16_1_2content,10tab16_1_3content, tab16_1_3contenttp, tab16_1_4content, tab16_1_4contenttp,11tab16_2_1content, tab16_2_1contenttp, tab16_2_2content, tab16_2_2contenttp,12tab16_2_3content, tab16_2_3contenttp, tab16_2_4content,13tab17_1_1content, tab17_1_2content, tab17_1_3content, tab17_1_4content,14tab17_1_4contenttp, tab17_2_1content, tab17_2_1contenttp, tab17_2_2content,15tab17_2_2contenttp, tab17_2_3content, tab17_2_3contenttp, tab17_2_4content,16tab17_2_4contenttp, tab18_1content, tab18_2content, tab18_3content,17tab18_4content, tab19_1content, tab19_2content, tab19_2contenttp,18tab19_3content, tab19_4content, tab19_4contenttp, tab20_1content,19tab20_1contenttp, tab20_2content, tab20_2contenttp, tab20_3content,20tab20_3contenttp, tab20_4content, tab20_4contenttp, tab20_5content,21tab20_5contenttp, tab20_6content, tab20_6contenttp, tab20_7content,22tab20_7contenttp, tab23_1_1content, tab23_1_1contenttp, tab23_1_2content,23tab23_1_2contenttp, tab23_1_3content, tab23_1_4content, tab23_2_1content,24tab23_2_1contenttp, tab23_2_2content, tab23_2_2contenttp, tab23_2_3content,25tab23_2_4content, tab24_1_1content, tab24_1_1contenttp, tab24_1_2content,26tab24_1_3content, tab24_1_4content, tab24_1_4contenttp, tab24_2_1content,27tab24_2_1contenttp, tab24_2_2content, tab24_2_3content, tab24_2_4content,28tab24_2_4contenttp, tab27_1_1content, tab27_1_2content, tab27_1_2contenttp,29tab27_1_3content, tab27_1_3contenttp, tab27_1_4content, tab27_1_4contenttp,30tab27_2_1content, tab27_2_1contenttp, tab27_2_2content, tab27_2_2contenttp,31tab27_2_3content, tab27_2_3contenttp, tab27_2_4content, tab27_2_4contenttp,32tab45_1content, tab45_2content, tab46_1content, tab46_2content,33tab47_1_1content, tab47_1_2content, tab47_1_3content, tab47_1_4content,34tab47_1_4contenttp, tab47_2_1content, tab47_2_2content, tab47_2_3content,35tab47_2_3contenttp, tab47_2_4content, tab47_2_4contenttp, tab56_1content,36tab56_2content, tab57_1content, tab57_2content, tab57_2contenttp,37tab57_3content, tab57_4content */38$(function () {39 var navflag = false40 $('.main-nav li').on('click', function () {41 if ($(this).children('.sub-nav').length) {42 if ($(this).children('.sub-nav').css('display') == 'block') {43 if (navflag) {44 navflag = false45 } else {46 $(this).children('.sub-nav').css('display', 'none')47 }48 return49 }50 $(this).parent().find('li.active')51 .children('.sub-nav').css('display', 'none').end()52 .removeClass('active')53 $(this).addClass('active')54 $(this).children('.sub-nav')55 .css('display', 'block')56 .children(':first').addClass('active')57 } else {58 $(this).parent().find('li.active')59 .children('.sub-nav').css('display', 'none').end()60 .removeClass('active')61 $(this).addClass('active')62 navflag = true63 }64 })65 $('.back-to-top li').on('click', function () {66 $('.main-nav').find('li.active')67 .children('.sub-nav').css('display', 'none').end()68 .removeClass('active')69 })70})71var tooltip = d3.select('body').append('div').attr('class', 'toolTip')72function showTooltip (event, text) {73 tooltip74 .style('left', event.pageX - 30 + 'px')75 .style('top', event.pageY - 30 + 'px')76 .style('display', 'inline-block')77 .html(text)78}79function hideTooltip () {80 tooltip.style('display', 'none')81}82// set up svg using margin conventions - we'll need plenty of room on the left for labels83var margin = {84 top: 15,85 right: 35,86 bottom: 15,87 left: 30088}89function createChart (strid, paramWidth, paramHeight, data, tooltipdata) {90 // console.log(data)91 var width = paramWidth - margin.left - margin.right92 var height = paramHeight - margin.top - margin.bottom93 var svg = d3.select(strid).append('svg')94 .attr('width', width + margin.left + margin.right)95 .attr('height', height + margin.top + margin.bottom)96 .append('g')97 .attr('transform', 'translate(' + margin.left + ',' + margin.top + ')')98 var x = d3.scale.linear()99 .range([0, width])100 .domain([0, d3.max(data, function (d) {101 if (d.value == '<1') return 0.5102 else return d.value103 })])104 var y = d3.scale.ordinal()105 .rangeRoundBands([height, 0], 0.7)106 .domain(data.map(function (d) {107 return d.name108 }))109 // make y axis to show bar names110 var yAxis = d3.svg.axis()111 .scale(y)112 // no tick marks113 .tickSize(0)114 .orient('left')115 var gy = svg.append('g')116 .attr('class', 'y axis')117 .call(yAxis)118 var bars = svg.selectAll('.bar')119 .data(data)120 .enter()121 .append('g')122 // append rects123 bars.append('rect')124 .attr('class', 'bar')125 .attr('y', function (d) {126 return y(d.name)127 })128 .attr('height', y.rangeBand())129 .attr('x', 0)130 .attr('width', function (d) {131 switch (d.value) {132 // dafuq?133 case '------------------------------------------------------------------------------------------------------------------------------------------':134 return x(0)135 case '<1':136 return x(0.5)137 default:138 return x(d.value)139 }140 })141 .on('mousemove', function (d) {142 if (tooltipdata === 0) return143 for (var i = tooltipdata.length - 1; i >= 0; i--) {144 if (d.name === tooltipdata[i].name) {145 if (tooltipdata[i].value === 0) {146 tooltip147 .style('left', d3.event.pageX - 30 + 'px')148 .style('top', d3.event.pageY - 30 + 'px')149 .style('display', 'inline-block')150 .html('decrease from previous year')151 } else {152 tooltip153 .style('left', d3.event.pageX - 30 + 'px')154 .style('top', d3.event.pageY - 30 + 'px')155 .style('display', 'inline-block')156 .html('increase from previous year')157 }158 }159 }160 })161 .on('mouseout', function (d) { tooltip.style('display', 'none') })162 // svg.append("g")163 // .attr("transform", "translate(0, "+y(yPos)+")")164 // .append("line")165 // .attr("x2", width)166 // .style("stroke", "#000")167 // .style("stroke-width", "2px")168 // add a value label to the right of each bar169 bars.append('text')170 .attr('class', 'label')171 // y position of the label is halfway down the bar172 .attr('y', function (d) {173 return y(d.name) + y.rangeBand() / 2 + 4174 })175 // x position is 3 pixels to the right of the bar176 .attr('x', function (d) {177 switch (d.value) {178 // dafuq?179 case '------------------------------------------------------------------------------------------------------------------------------------------':180 return x(0)181 case '<1':182 return x(0.5) + 5183 default:184 return x(d.value) + 5185 }186 })187 .text(function (d) {188 return d.value + d.unit189 })190}191function onCapture1_1 (event) {192 // console.log(event.offsetX,event.offsetY);193 if (event.offsetX > 106 && event.offsetX < 142 && event.offsetY > 96 && event.offsetY < 205) {194 showTooltip(event, 'decrease from previous year')195 } else if (event.offsetX > 106 && event.offsetX < 142 && event.offsetY > 205 && event.offsetY < 280) {196 showTooltip(event, 'increase from previous year')197 } else {198 hideTooltip()199 }200}201margin.left = 150202createChart('#tab7content', 500, 200, tab7content, 0)203function onCapture2 (event) {204 // console.log(event.offsetX,event.offsetY);205 if (event.offsetX > 82 && event.offsetX < 85 && event.offsetY > 266 && event.offsetY < 276) {206 showTooltip(event, 'decrease from previous year')207 } else if (event.offsetX > 342 && event.offsetX < 395 && event.offsetY > 53 && event.offsetY < 60) {208 showTooltip(event, 'decrease from previous year')209 } else if (event.offsetX > 342 && event.offsetX < 362 && event.offsetY > 89 && event.offsetY < 97) {210 showTooltip(event, 'increase from previous year')211 } else if (event.offsetX > 342 && event.offsetX < 354 && event.offsetY > 164 && event.offsetY < 170) {212 showTooltip(event, 'increase from previous year')213 } else if (event.offsetX > 342 && event.offsetX < 345 && event.offsetY > 267 && event.offsetY < 273) {214 showTooltip(event, 'decrease from previous year')215 } else {216 hideTooltip()217 }218}219function onCapture3 (event) {220 // console.log(event.offsetX,event.offsetY);221 if (event.offsetX > 126 && event.offsetX < 163 && event.offsetY > 78 && event.offsetY < 104) {222 showTooltip(event, 'increase from previous year')223 } else if (event.offsetX > 404 && event.offsetX < 458 && event.offsetY > 311 && event.offsetY < 331) {224 showTooltip(event, 'increase from previous year')225 } else if (event.offsetX > 457 && event.offsetX < 563 && event.offsetY > 314 && event.offsetY < 331) {226 showTooltip(event, 'decrease from previous year')227 } else if (event.offsetX > 692 && event.offsetX < 742 && event.offsetY > 314 && event.offsetY < 331) {228 showTooltip(event, 'decrease from previous year')229 } else {230 hideTooltip()231 }232}233margin.left = 300234createChart('#tab10_1_1content', 600, 250, tab10_1_1content, 0)235createChart('#tab10_1_2content', 600, 250, tab10_1_2content, tab10_1_2contenttp)236createChart('#tab10_1_3content', 600, 250, tab10_1_3content, tab10_1_3contenttp)237createChart('#tab10_1_4content', 600, 250, tab10_1_4content, 0)238createChart('#tab10_2_1content', 600, 250, tab10_2_1content, 0)239createChart('#tab10_2_2content', 600, 250, tab10_2_2content, 0)240createChart('#tab10_2_3content', 600, 250, tab10_2_3content, tab10_2_3contenttp)241createChart('#tab10_2_4content', 600, 250, tab10_2_4content, 0)242function onCapture5 (event) {243 // console.log(event.offsetX,event.offsetY);244 if (event.offsetX > 152 && event.offsetX < 187 && event.offsetY > 71 && event.offsetY < 172) {245 tooltip246 .style('left', event.pageX - 30 + 'px')247 .style('top', event.pageY - 70 + 'px')248 .style('display', 'inline-block')249 .html("<i>Especially. . .<li>APAC &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 56%</li><li>&lt100 ee's 48%</li></i>")250 } else {251 hideTooltip()252 }253}254function onCapture6 (event) {255 // console.log(event.offsetX,event.offsetY);256 if (event.offsetX > 223 && event.offsetX < 400 && event.offsetY > 82 && event.offsetY < 92) {257 showTooltip(event, 'decrease from previous year')258 } else {259 hideTooltip()260 }261}262margin.left = 200263createChart('#tab13_1content', 600, 400, tab13_1content, tab13_1contenttp)264createChart('#tab13_2content', 600, 400, tab13_2content, 0)265createChart('#tab13_3content', 600, 400, tab13_3content, tab13_3contenttp)266createChart('#tab13_4content', 600, 400, tab13_4content, 0)267margin.left = 300268createChart('#tab14_1_1content', 600, 400, tab14_1_1content, tab14_1_1contenttp)269createChart('#tab14_1_2content', 600, 400, tab14_1_2content, 0)270createChart('#tab14_1_3content', 600, 400, tab14_1_3content, 0)271createChart('#tab14_1_4content', 600, 400, tab14_1_4content, tab14_1_4contenttp)272createChart('#tab14_2_1content', 600, 400, tab14_2_1content, tab14_2_1contenttp)273createChart('#tab14_2_2content', 600, 400, tab14_2_2content, 0)274createChart('#tab14_2_3content', 600, 400, tab14_2_3content, 0)275createChart('#tab14_2_4content', 600, 400, tab14_2_4content, tab14_2_4contenttp)276function onCapture8 (event) {277 // console.log(event.offsetX,event.offsetY);278 if (event.offsetX > 226 && event.offsetX < 312 && event.offsetY > 167 && event.offsetY < 177) {279 showTooltip(event, 'decrease from previous year')280 } else if (event.offsetX > 226 && event.offsetX < 246 && event.offsetY > 306 && event.offsetY < 316) {281 showTooltip(event, 'increase from previous year')282 } else if (event.offsetX > 226 && event.offsetX < 248 && event.offsetY > 353 && event.offsetY < 362) {283 showTooltip(event, 'increase from previous year')284 } else if (event.offsetX > 226 && event.offsetX < 230 && event.offsetY > 398 && event.offsetY < 409) {285 showTooltip(event, 'decrease from previous year')286 } else if (event.offsetX > 713 && event.offsetX < 796 && event.offsetY > 165 && event.offsetY < 174) {287 showTooltip(event, 'increase from previous year')288 } else if (event.offsetX > 714 && event.offsetX < 728 && event.offsetY > 306 && event.offsetY < 316) {289 showTooltip(event, 'increase from previous year')290 } else if (event.offsetX > 714 && event.offsetX < 717 && event.offsetY > 396 && event.offsetY < 407) {291 showTooltip(event, 'decrease from previous year')292 } else {293 hideTooltip()294 }295}296margin.left = 200297createChart('#tab16_1_1content', 600, 400, tab16_1_1content, 0)298createChart('#tab16_1_2content', 600, 400, tab16_1_2content, 0)299createChart('#tab16_1_3content', 600, 400, tab16_1_3content, tab16_1_3contenttp)300createChart('#tab16_1_4content', 600, 400, tab16_1_4content, tab16_1_4contenttp)301createChart('#tab16_2_1content', 600, 400, tab16_2_1content, tab16_2_1contenttp)302createChart('#tab16_2_2content', 600, 400, tab16_2_2content, tab16_2_2contenttp)303createChart('#tab16_2_3content', 600, 400, tab16_2_3content, tab16_2_3contenttp)304createChart('#tab16_2_4content', 600, 400, tab16_2_4content, tab14_2_4contenttp)305margin.left = 200306createChart('#tab17_1_1content', 600, 400, tab17_1_1content, 0)307createChart('#tab17_1_2content', 600, 400, tab17_1_2content, 0)308createChart('#tab17_1_3content', 600, 400, tab17_1_3content, 0)309createChart('#tab17_1_4content', 600, 400, tab17_1_4content, tab17_1_4contenttp)310createChart('#tab17_2_1content', 600, 400, tab17_2_1content, tab17_2_1contenttp)311createChart('#tab17_2_2content', 600, 400, tab17_2_2content, tab17_2_2contenttp)312createChart('#tab17_2_3content', 600, 400, tab17_2_3content, tab17_2_3contenttp)313createChart('#tab17_2_4content', 600, 400, tab17_2_4content, tab17_2_4contenttp)314margin.left = 200315createChart('#tab18_1content', 600, 400, tab18_1content, 0)316createChart('#tab18_2content', 600, 400, tab18_2content, 0)317createChart('#tab18_3content', 600, 400, tab18_3content, 0)318createChart('#tab18_4content', 600, 400, tab18_4content, 0)319function onCapture11 (event) {320 // console.log(event.offsetX,event.offsetY);321 if (event.offsetX > 165 && event.offsetX < 240 && event.offsetY > 167 && event.offsetY < 175) {322 showTooltip(event, '<b>3%</b> are Hobbyists only')323 } else {324 hideTooltip()325 }326}327function onCapture12 (event) {328 // console.log(event.offsetX,event.offsetY);329 if (event.offsetX > 270 && event.offsetX < 356 && event.offsetY > 300 && event.offsetY < 311) {330 showTooltip(event, 'decrease from previous year')331 } else if (event.offsetX > 270 && event.offsetX < 300 && event.offsetY > 345 && event.offsetY < 355) {332 showTooltip(event, 'decrease from previous year')333 } else {334 hideTooltip()335 }336}337margin.left = 200338createChart('#tab19_1content', 600, 400, tab19_1content, 0)339createChart('#tab19_2content', 600, 400, tab19_2content, tab19_2contenttp)340createChart('#tab19_3content', 600, 400, tab19_3content, 0)341createChart('#tab19_4content', 600, 400, tab19_4content, tab19_4contenttp)342margin.left = 200343createChart('#tab20_1content', 600, 300, tab20_1content, tab20_1contenttp)344createChart('#tab20_2content', 600, 300, tab20_2content, tab20_2contenttp)345createChart('#tab20_3content', 600, 300, tab20_3content, tab20_3contenttp)346createChart('#tab20_4content', 600, 300, tab20_4content, tab20_4contenttp)347createChart('#tab20_5content', 600, 300, tab20_5content, tab20_5contenttp)348createChart('#tab20_6content', 600, 300, tab20_6content, tab20_6contenttp)349createChart('#tab20_7content', 600, 300, tab20_7content, tab20_7contenttp)350function onCapture15 (event) {351 // console.log(event.offsetX,event.offsetY);352 if (event.offsetX > 118 && event.offsetX < 141 && event.offsetY > 158 && event.offsetY < 170) {353 showTooltip(event, 'increase from previous year')354 } else if (event.offsetX > 293 && event.offsetX < 377 && event.offsetY > 101 && event.offsetY < 110) {355 showTooltip(event, 'decrease from previous year')356 } else if (event.offsetX > 293 && event.offsetX < 342 && event.offsetY > 158 && event.offsetY < 170) {357 showTooltip(event, 'increase from previous year')358 } else {359 hideTooltip()360 }361}362margin.left = 200363createChart('#tab23_1_1content', 600, 400, tab23_1_1content, tab23_1_1contenttp)364createChart('#tab23_1_2content', 600, 400, tab23_1_2content, tab23_1_2contenttp)365createChart('#tab23_1_3content', 600, 400, tab23_1_3content, 0)366createChart('#tab23_1_4content', 600, 400, tab23_1_4content, 0)367createChart('#tab23_2_1content', 600, 400, tab23_2_1content, tab23_2_1contenttp)368createChart('#tab23_2_2content', 600, 400, tab23_2_2content, tab23_2_2contenttp)369createChart('#tab23_2_3content', 600, 400, tab23_2_3content, 0)370createChart('#tab23_2_4content', 600, 400, tab23_2_4content, 0)371margin.left = 200372createChart('#tab24_1_1content', 600, 400, tab24_1_1content, tab24_1_1contenttp)373createChart('#tab24_1_2content', 600, 400, tab24_1_2content, 0)374createChart('#tab24_1_3content', 600, 400, tab24_1_3content, 0)375createChart('#tab24_1_4content', 600, 400, tab24_1_4content, tab24_1_4contenttp)376createChart('#tab24_2_1content', 600, 400, tab24_2_1content, tab24_2_1contenttp)377createChart('#tab24_2_2content', 600, 400, tab24_2_2content, 0)378createChart('#tab24_2_3content', 600, 400, tab24_2_3content, 0)379createChart('#tab24_2_4content', 600, 400, tab24_2_4content, tab24_2_4contenttp)380function onCapture18 (event) {381 // console.log(event.offsetX,event.offsetY);382 if (event.offsetX > 106 && event.offsetX < 347 && event.offsetY > 69 && event.offsetY < 78) {383 showTooltip(event, 'increase from previous year')384 } else if (event.offsetX > 107 && event.offsetX < 141 && event.offsetY > 375 && event.offsetY < 387) {385 showTooltip(event, 'decrease from previous year')386 } else if (event.offsetX > 718 && event.offsetX < 748 && event.offsetY > 208 && event.offsetY < 226) {387 showTooltip(event, 'Up from 11% in ‘16')388 } else {389 hideTooltip()390 }391}392margin.left = 200393createChart('#tab27_1_1content', 600, 400, tab27_1_1content, 0)394createChart('#tab27_1_2content', 600, 400, tab27_1_2content, tab27_1_2contenttp)395createChart('#tab27_1_3content', 600, 400, tab27_1_3content, tab27_1_3contenttp)396createChart('#tab27_1_4content', 600, 400, tab27_1_4content, tab27_1_4contenttp)397createChart('#tab27_2_1content', 600, 400, tab27_2_1content, tab27_2_1contenttp)398createChart('#tab27_2_2content', 600, 400, tab27_2_2content, tab27_2_2contenttp)399createChart('#tab27_2_3content', 600, 400, tab27_2_3content, tab27_2_3contenttp)400createChart('#tab27_2_4content', 600, 400, tab27_2_4content, tab27_2_4contenttp)401function onCapture20 (event) {402 // console.log(event.offsetX,event.offsetY);403 if (event.offsetX > 131 && event.offsetX < 153 && event.offsetY > 97 && event.offsetY < 219) {404 showTooltip(event, 'increase from previous year')405 } else if (event.offsetX > 214 && event.offsetX < 234 && event.offsetY > 96 && event.offsetY < 219) {406 showTooltip(event, 'Up from 69% in ‘16')407 } else if (event.offsetX > 622 && event.offsetX < 644 && event.offsetY > 96 && event.offsetY < 219) {408 showTooltip(event, 'Up from 71% in ‘16')409 } else {410 hideTooltip()411 }412}413function onCapture21 (event) {414 // console.log(event.offsetX,event.offsetY);415 if (event.offsetX > 158 && event.offsetX < 172 && event.offsetY > 106 && event.offsetY < 229) {416 showTooltip(event, 'increase from previous year')417 } else if (event.offsetX > 277 && event.offsetX < 292 && event.offsetY > 116 && event.offsetY < 229) {418 tooltip419 .style('left', event.pageX - 30 + 'px')420 .style('top', event.pageY - 90 + 'px')421 .style('display', 'inline-block')422 .html('Up from 66% in ‘16<br><i>Especially...<li>LatAm 85%</li><li>APAC 79%</li></i>')423 } else if (event.offsetX > 456 && event.offsetX < 471 && event.offsetY > 148 && event.offsetY < 230) {424 showTooltip(event, 'Up from 42% in ‘16')425 } else if (event.offsetX > 811 && event.offsetX < 826 && event.offsetY > 192 && event.offsetY < 229) {426 tooltip427 .style('left', event.pageX - 30 + 'px')428 .style('top', event.pageY - 70 + 'px')429 .style('display', 'inline-block')430 .html('Up from 14% in ‘16<br><i>Especially...<li>APAC 46%</li></i>')431 } else {432 hideTooltip()433 }434}435function onCapture22 (event) {436 // console.log(event.offsetX,event.offsetY);437 if (event.offsetX > 99 && event.offsetX < 112 && event.offsetY > 70 && event.offsetY < 176) {438 showTooltip(event, 'increase from previous year')439 } else if (event.offsetX > 266 && event.offsetX < 280 && event.offsetY > 79 && event.offsetY < 175) {440 showTooltip(event, 'increase from previous year')441 } else if (event.offsetX > 605 && event.offsetX < 617 && event.offsetY > 207 && event.offsetY < 263) {442 showTooltip(event, 'increase from previous year')443 } else {444 hideTooltip()445 }446}447function onCapture24 (event) {448 // console.log(event.offsetX,event.offsetY);449 if (event.offsetX > 60 && event.offsetX < 230 && event.offsetY > 90 && event.offsetY < 104) {450 tooltip451 .style('left', event.pageX - 30 + 'px')452 .style('top', event.pageY - 50 + 'px')453 .style('display', 'inline-block')454 .html('<i>Especially...<br><li>US/CA 64%</li></i>')455 } else if (event.offsetX > 61 && event.offsetX < 96 && event.offsetY > 152 && event.offsetY < 164) {456 showTooltip(event, 'increase from previous year')457 } else if (event.offsetX > 651 && event.offsetX < 782 && event.offsetY > 144 && event.offsetY < 155) {458 showTooltip(event, 'increase from previous year')459 } else if (event.offsetX > 651 && event.offsetX < 654 && event.offsetY > 198 && event.offsetY < 208) {460 showTooltip(event, 'decrease from previous year')461 } else if (event.offsetX > 651 && event.offsetX < 654 && event.offsetY > 251 && event.offsetY < 261) {462 showTooltip(event, 'decrease from previous year')463 } else {464 hideTooltip()465 }466}467function onCapture25 (event) {468 // console.log(event.offsetX,event.offsetY);469 if (event.offsetX > 169 && event.offsetX < 190 && event.offsetY > 95 && event.offsetY < 206) {470 tooltip471 .style('left', event.pageX - 30 + 'px')472 .style('top', event.pageY - 50 + 'px')473 .style('display', 'inline-block')474 .html('increase from previous year')475 } else if (event.offsetX > 325 && event.offsetX < 347 && event.offsetY > 90 && event.offsetY < 206) {476 showTooltip(event, 'Up from 36% in ‘16')477 } else if (event.offsetX > 562 && event.offsetX < 582 && event.offsetY > 101 && event.offsetY < 207) {478 showTooltip(event, 'Up from 34% in ‘16')479 } else if (event.offsetX > 169 && event.offsetX < 190 && event.offsetY > 250 && event.offsetY < 276) {480 showTooltip(event, 'decrease from previous year')481 } else if (event.offsetX > 246 && event.offsetX < 267 && event.offsetY > 250 && event.offsetY < 277) {482 showTooltip(event, 'decrease from previous year')483 } else if (event.offsetX > 326 && event.offsetX < 347 && event.offsetY > 250 && event.offsetY < 272) {484 showTooltip(event, 'decrease from previous year')485 } else if (event.offsetX > 561 && event.offsetX < 582 && event.offsetY > 250 && event.offsetY < 280) {486 showTooltip(event, 'decrease from previous year')487 } else if (event.offsetX > 719 && event.offsetX < 740 && event.offsetY > 249 && event.offsetY < 261) {488 showTooltip(event, 'decrease from previous year')489 } else {490 hideTooltip()491 }492}493function onCapture27 (event) {494 // console.log(event.offsetX,event.offsetY);495 if (event.offsetX > 267 && event.offsetX < 482 && event.offsetY > 72 && event.offsetY < 89) {496 tooltip497 .style('left', event.pageX - 30 + 'px')498 .style('top', event.pageY - 50 + 'px')499 .style('display', 'inline-block')500 .html('<i>Especially<li>Outside US/CA 41%</li></i>')501 } else if (event.offsetX > 266 && event.offsetX < 289 && event.offsetY > 153 && event.offsetY < 168) {502 tooltip503 .style('left', event.pageX - 30 + 'px')504 .style('top', event.pageY - 50 + 'px')505 .style('display', 'inline-block')506 .html('<i>Especially<li>APAC 9%</li></i>')507 } else if (event.offsetX > 267 && event.offsetX < 441 && event.offsetY > 359 && event.offsetY < 376) {508 tooltip509 .style('left', event.pageX - 30 + 'px')510 .style('top', event.pageY - 50 + 'px')511 .style('display', 'inline-block')512 .html('<i>Especially<li>APAC 36%</li></i>')513 } else {514 hideTooltip()515 }516}517function onCapture28 (event) {518 // console.log(event.offsetX,event.offsetY);519 if (event.offsetX > 129 && event.offsetX < 152 && event.offsetY > 144 && event.offsetY < 215) {520 showTooltip(event, 'increase from previous year')521 } else if (event.offsetX > 376 && event.offsetX < 398 && event.offsetY > 141 && event.offsetY < 214) {522 showTooltip(event, 'increase from previous year')523 } else {524 hideTooltip()525 }526}527function onCapture29 (event) {528 // console.log(event.offsetX,event.offsetY);529 if (event.offsetX > 119 && event.offsetX < 137 && event.offsetY > 81 && event.offsetY < 192) {530 showTooltip(event, 'increase from previous year')531 } else if (event.offsetX > 598 && event.offsetX < 615 && event.offsetY > 238 && event.offsetY < 242) {532 showTooltip(event, 'decrease from previous year')533 } else {534 hideTooltip()535 }536}537function onCapture30 (event) {538 // console.log(event.offsetX,event.offsetY);539 if (event.offsetX > 140 && event.offsetX < 291 && event.offsetY > 130 && event.offsetY < 140) {540 showTooltip(event, 'increase from previous year')541 } else if (event.offsetX > 140 && event.offsetX < 277 && event.offsetY > 174 && event.offsetY < 184) {542 showTooltip(event, 'increase from previous year')543 } else if (event.offsetX > 140 && event.offsetX < 244 && event.offsetY > 218 && event.offsetY < 228) {544 showTooltip(event, 'increase from previous year')545 } else if (event.offsetX > 140 && event.offsetX < 232 && event.offsetY > 262 && event.offsetY < 272) {546 showTooltip(event, 'increase from previous year')547 } else if (event.offsetX > 703 && event.offsetX < 831 && event.offsetY > 130 && event.offsetY < 140) {548 showTooltip(event, 'increase from previous year')549 } else if (event.offsetX > 703 && event.offsetX < 794 && event.offsetY > 218 && event.offsetY < 228) {550 showTooltip(event, 'increase from previous year')551 } else if (event.offsetX > 703 && event.offsetX < 759 && event.offsetY > 305 && event.offsetY < 315) {552 showTooltip(event, 'increase from previous year')553 } else {554 hideTooltip()555 }556}557function onCapture31 (event) {558 // console.log(event.offsetX,event.offsetY);559 if (event.offsetX > 83 && event.offsetX < 96 && event.offsetY > 119 && event.offsetY < 249) {560 showTooltip(event, 'increase from previous year')561 } else if (event.offsetX > 117 && event.offsetX < 130 && event.offsetY > 119 && event.offsetY < 249) {562 showTooltip(event, 'increase from previous year')563 } else if (event.offsetX > 255 && event.offsetX < 268 && event.offsetY > 153 && event.offsetY < 249) {564 showTooltip(event, 'increase from previous year')565 } else if (event.offsetX > 425 && event.offsetX < 438 && event.offsetY > 156 && event.offsetY < 249) {566 showTooltip(event, 'increase from previous year')567 } else if (event.offsetX > 461 && event.offsetX < 474 && event.offsetY > 164 && event.offsetY < 249) {568 showTooltip(event, 'increase from previous year')569 } else if (event.offsetX > 700 && event.offsetX < 713 && event.offsetY > 175 && event.offsetY < 249) {570 showTooltip(event, 'increase from previous year')571 } else if (event.offsetX > 870 && event.offsetX < 883 && event.offsetY > 190 && event.offsetY < 249) {572 showTooltip(event, 'increase from previous year')573 } else {574 hideTooltip()575 }576}577function onCapture32 (event) {578 // console.log(event.offsetX,event.offsetY);579 if (event.offsetX > 267 && event.offsetX < 280 && event.offsetY > 137 && event.offsetY < 239) {580 showTooltip(event, 'increase from previous year')581 } else if (event.offsetX > 602 && event.offsetX < 615 && event.offsetY > 178 && event.offsetY < 239) {582 showTooltip(event, 'increase from previous year')583 } else {584 hideTooltip()585 }586}587function onCapture33 (event) {588 // console.log(event.offsetX,event.offsetY);589 if (event.offsetX > 79 && event.offsetX < 90 && event.offsetY > 132 && event.offsetY < 244) {590 showTooltip(event, 'increase from previous year')591 } else if (event.offsetX > 111 && event.offsetX < 122 && event.offsetY > 113 && event.offsetY < 244) {592 showTooltip(event, 'increase from previous year')593 } else if (event.offsetX > 204 && event.offsetX < 215 && event.offsetY > 157 && event.offsetY < 244) {594 showTooltip(event, 'increase from previous year')595 } else if (event.offsetX > 236 && event.offsetX < 247 && event.offsetY > 140 && event.offsetY < 244) {596 showTooltip(event, 'increase from previous year')597 } else if (event.offsetX > 725 && event.offsetX < 736 && event.offsetY > 140 && event.offsetY < 244) {598 showTooltip(event, 'increase from previous year')599 } else {600 hideTooltip()601 }602}603function onCapture35 (event) {604 console.log(event.offsetX, event.offsetY)605 if (event.offsetX > 195 && event.offsetX < 353 && event.offsetY > 161 && event.offsetY < 171) {606 showTooltip(event, 'increase from previous year')607 } else if (event.offsetX > 195 && event.offsetX < 273 && event.offsetY > 225 && event.offsetY < 235) {608 showTooltip(event, 'increase from previous year')609 } else if (event.offsetX > 195 && event.offsetX < 237 && event.offsetY > 322 && event.offsetY < 332) {610 showTooltip(event, 'decrease from previous year')611 } else if (event.offsetX > 195 && event.offsetX < 224 && event.offsetY > 417 && event.offsetY < 427) {612 showTooltip(event, 'decrease from previous year')613 } else {614 hideTooltip()615 }616}617margin.left = 200618createChart('#tab45_1content', 600, 400, tab45_1content, 0)619createChart('#tab45_2content', 600, 400, tab45_2content, 0)620function onCapture36 (event) {621 // console.log(event.offsetX,event.offsetY);622 if (event.offsetX > 233 && event.offsetX < 307 && event.offsetY > 239 && event.offsetY < 250) {623 showTooltip(event, 'decrease from previous year')624 } else if (event.offsetX > 233 && event.offsetX < 301 && event.offsetY > 303 && event.offsetY < 314) {625 showTooltip(event, 'increase from previous year')626 } else if (event.offsetX > 233 && event.offsetX < 296 && event.offsetY > 371 && event.offsetY < 382) {627 showTooltip(event, 'decrease from previous year')628 } else {629 hideTooltip()630 }631}632margin.left = 200633createChart('#tab46_1content', 600, 400, tab46_1content, 0)634createChart('#tab46_2content', 600, 400, tab46_2content, 0)635margin.left = 200636createChart('#tab47_1_1content', 600, 400, tab47_1_1content, 0)637createChart('#tab47_1_2content', 600, 400, tab47_1_2content, 0)638createChart('#tab47_1_3content', 600, 400, tab47_1_3content, 0)639createChart('#tab47_1_4content', 600, 400, tab47_1_4content, tab47_1_4contenttp)640createChart('#tab47_2_1content', 600, 400, tab47_2_1content, 0)641createChart('#tab47_2_2content', 600, 400, tab47_2_2content, 0)642createChart('#tab47_2_3content', 600, 400, tab47_2_3content, tab47_2_3contenttp)643createChart('#tab47_2_4content', 600, 400, tab47_2_4content, tab47_2_4contenttp)644function onCapture38 (event) {645 // console.log(event.offsetX,event.offsetY);646 if (event.offsetX > 711 && event.offsetX < 810 && event.offsetY > 86 && event.offsetY < 96) {647 tooltip648 .style('left', event.pageX - 30 + 'px')649 .style('top', event.pageY - 120 + 'px')650 .style('display', 'inline-block')651 .html('<i>Especially...<li>LatAm 61%</li><li>US/CA 57%</li><li>Back End 56%</li><li>APAC 55%</li><li>Using Node 55%<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2+ yrs</li></i>')652 } else if (event.offsetX > 711 && event.offsetX < 731 && event.offsetY > 174 && event.offsetY < 184) {653 showTooltip(event, 'decrease from previous year')654 } else {655 hideTooltip()656 }657}658function onCapture39 (event) {659 // console.log(event.offsetX,event.offsetY);660 if (event.offsetX > 69 && event.offsetX < 254 && event.offsetY > 67 && event.offsetY < 102) {661 tooltip662 .style('left', event.pageX - 30 + 'px')663 .style('top', event.pageY - 60 + 'px')664 .style('display', 'inline-block')665 .html('<i>LTS especially used by...<li>1000+ ee’s 63%</li><li>Back-end 61%</li></i>')666 } else if (event.offsetX > 251 && event.offsetX < 402 && event.offsetY > 67 && event.offsetY < 102) {667 tooltip668 .style('left', event.pageX - 30 + 'px')669 .style('top', event.pageY - 60 + 'px')670 .style('display', 'inline-block')671 .html('<i>Current especially used by...<li>&lt;100 ee’s 47%</li><li>Use &lt; 2 yrs 47%</li></i>')672 } else {673 hideTooltip()674 }675}676function onCapture41 (event) {677 // console.log(event.offsetX, event.offsetY)678 if (event.offsetX > 125 && event.offsetX < 141 && event.offsetY > 112 && event.offsetY < 228) {679 showTooltip(event, 'decrease from previous year')680 } else if (event.offsetX > 244 && event.offsetX < 260 && event.offsetY > 112 && event.offsetY < 228) {681 showTooltip(event, 'Down from 59%')682 } else if (event.offsetX > 303 && event.offsetX < 319 && event.offsetY > 136 && event.offsetY < 228) {683 showTooltip(event, 'Down from 56%')684 } else if (event.offsetX > 423 && event.offsetX < 439 && event.offsetY > 108 && event.offsetY < 228) {685 showTooltip(event, 'Down from 62%')686 } else if (event.offsetX > 482 && event.offsetX < 498 && event.offsetY > 105 && event.offsetY < 228) {687 showTooltip(event, 'Down from 57%')688 } else if (event.offsetX > 661 && event.offsetX < 677 && event.offsetY > 121 && event.offsetY < 228) {689 showTooltip(event, 'Down from 63%')690 } else if (event.offsetX > 125 && event.offsetX < 140 && event.offsetY > 271 && event.offsetY < 282) {691 showTooltip(event, 'decrease from previous year')692 } else if (event.offsetX > 780 && event.offsetX < 795 && event.offsetY > 271 && event.offsetY < 277) {693 showTooltip(event, 'decrease from previous year')694 } else {695 hideTooltip()696 }697}698margin.left = 300699createChart('#tab56_1content', 600, 400, tab56_1content, 0)700createChart('#tab56_2content', 600, 400, tab56_2content, 0)701margin.left = 300702createChart('#tab57_1content', 600, 400, tab57_1content, 0)703createChart('#tab57_2content', 600, 400, tab57_2content, tab57_2contenttp)704createChart('#tab57_3content', 600, 400, tab57_3content, 0)705createChart('#tab57_4content', 600, 400, tab57_4content, tab57_4contenttp)706$(document).on('mousemove', 'img[data-capture]', function (event) {707 window['onCapture' + $(this).attr('data-capture')](event)...

Full Screen

Full Screen

MapTileIcons.js

Source:MapTileIcons.js Github

copy

Full Screen

1var MapTileIcons = {2 tileSets: {3 dungeon: "tiles/dungeon_features.gif",4 items: "tiles/items.gif",5 corpses: "tiles/corpses.png"6 },7 imgs: {8 },9 // dungeon features10 doorClosed: { img: "dungeon", offsetX: 128, offsetY: 64, kind:"doorClosed", obstructed:true },11 doorOpen: { img: "dungeon", offsetX: 160, offsetY: 64, kind: "doorOpen" },12 doorHidden: { img: "dungeon", offsetX: 0, offsetY: 32, kind: "doorHidden", obstructed: true, hidden: true },13 floor: { img: "dungeon", offsetX: 64, offsetY: 0, kind: "floor" },14 stairsDown: { img: "dungeon", offsetX: 0, offsetY: 64, kind: "stairsDown" },15 stairsUp: { img: "dungeon", offsetX: 32, offsetY: 64, kind: "stairsUp" },16 wall: { img: "dungeon", offsetX: 0, offsetY: 32, kind: "wall", obstructed: true },17 18 throne: { img: "dungeon", offsetX: 0, offsetY: 128, kind: "throne" },19 bighead: { img: "dungeon", offsetX: 96, offsetY: 160, kind: "bighead", obstructed: true },20 //armor21 leather: { img: "items", offsetX: 480, offsetY: 160 },22 studdedleather: { img: "items", offsetX: 512, offsetY: 160 },23 scalemail: { img: "items", offsetX: 64, offsetY: 192 },24 chainmail: { img: "items", offsetX: 576, offsetY: 160 },25 fieldplate: { img: "items", offsetX: 256, offsetY: 192 },26 27 //helmets28 leathercap: { img: "items", offsetX: 0, offsetY: 256 },29 ironhelm: { img: "items", offsetX: 96, offsetY: 256 },30 fullhelm: { img: "items", offsetX: 160, offsetY: 256 },31 hornedhelm: { img: "items", offsetX: 128, offsetY: 256 },32 33 //shields34 smallshield:{ img: "items", offsetX: 352, offsetY: 224 },35 shield: { img: "items", offsetX: 320, offsetY: 224 },36 37 //gloves38 leatherglove:{img: "items", offsetX: 192, offsetY: 256 },39 mailglove: { img: "items", offsetX: 256, offsetY: 256 },40 plateglove: { img: "items", offsetX: 288, offsetY: 256 },41 //shoes42 leathershoes:{img: "items", offsetX: 320, offsetY: 256 },43 leatherboots:{img: "items", offsetX: 352, offsetY: 256 },44 sandals: { img: "items", offsetX: 384, offsetY: 256 },45 46 //weapons47 club: { img: "items", offsetX: 480, offsetY: 0 },48 dagger: { img: "items", offsetX: 320, offsetY: 32 },49 handaxe: { img: "items", offsetX: 384, offsetY: 64 },50 longsword: { img: "items", offsetX: 544, offsetY: 32 },51 shortsword: { img: "items", offsetX: 512, offsetY: 32 },52 spear: { img: "items", offsetX: 192, offsetY: 96 },53 crossbow: { img: "items", offsetX: 0, offsetY: 96 },54 longbow: { img: "items", offsetX: 608, offsetY: 64 },55 shortbow: { img: "items", offsetX: 608, offsetY: 64 },56 sling: { img: "items", offsetX: 576, offsetY: 64 },57 arrow: { img: "items", offsetX: 384, offsetY: 96 },58 crossbowbolt:{img: "items", offsetX: 32, offsetY: 128 },59 slingstone: { img: "items", offsetX: 352, offsetY: 96 },60 slingbullet:{ img: "items", offsetX: 320, offsetY: 160 },61 //food62 meat: { img: "items", offsetX: 192, offsetY: 288 },63 bread: { img: "items", offsetX: 224, offsetY: 288 },64 pear: { img: "items", offsetX: 256, offsetY: 288 },65 apple: { img: "items", offsetX: 288, offsetY: 288 },66 cheese: { img: "items", offsetX: 160, offsetY: 320 },67 sausage: { img: "items", offsetX: 192, offsetY: 320 },68 69 //dead things70 bones: { img: "items", offsetX: 256, offsetY: 320 },71 deadHumanoidBrown: { img: "corpses", offsetX: 32, offsetY: 0 },72 deadHumanoidGray: { img: "corpses", offsetX: 64, offsetY: 0 },73 deadHumanoidFlesh: { img: "corpses", offsetX: 96, offsetY: 0 },74 deadInsect: { img: "corpses", offsetX: 928, offsetY: 0 },75 deadEquine: { img: "corpses", offsetX: 736, offsetY: 32 },76 deadGoblin: { img: "corpses", offsetX: 64, offsetY: 64 },77 deadDog: { img: "corpses", offsetX: 160, offsetY: 64 },78 deadRatGreen: { img: "corpses", offsetX: 832, offsetY: 64 },79 deadRatGray: { img: "corpses", offsetX: 864, offsetY: 64 },80 deadRatOrange: { img: "corpses", offsetX: 896, offsetY: 64 },81 82 loadImages: function() {83 for (var key in MapTileIcons.tileSets) {84 MapTileIcons.imgs[key] = new Image();85 MapTileIcons.imgs[key].src = MapTileIcons.tileSets[key];86 }87 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1export const parameters = {2 viewport: {3 },4 options: {5 storySort: {6 },7 },8};9import { withViewport } from '@storybook/addon-viewport';10export default {11};12export const Default = () => <div>Default</div>;13Default.parameters = {14 viewport: {15 },16};17export const Mobile = () => <div>Mobile</div>;18Mobile.parameters = {19 viewport: {20 },21};22export const Desktop = () => <div>Desktop</div>;23Desktop.parameters = {24 viewport: {25 },26};27import { Meta, Story, Preview } from '@storybook/addon-docs/blocks';28import { withViewport } from '@storybook/addon-viewport';29<Meta title="Test" decorators={[withViewport]} />30 <Story name="Default" parameters={{ viewport: { defaultViewport: 'iphone6' } }}>31 {() => <div>Default</div>}32 <Story name="Mobile" parameters={{ viewport: { defaultViewport: 'iphone6' } }}>33 {() => <div>Mobile</div>}34 <Story name="Desktop" parameters={{ viewport: { defaultViewport: 'ipad' } }}>35 {() => <div>Desktop</div>}

Full Screen

Using AI Code Generation

copy

Full Screen

1const root = document.querySelector('.storybook-root');2const offset = root.offsetTop;3const iframe = document.querySelector('.storybook-preview-iframe');4const offset = iframe.offsetTop;5const wrapper = document.querySelector('.storybook-preview-wrapper');6const offset = wrapper.offsetTop;7const iframe = document.querySelector('.storybook-preview-iframe');8const offset = iframe.offsetTop;9const wrapper = document.querySelector('.storybook-preview-wrapper');10const offset = wrapper.offsetTop;11const iframe = document.querySelector('.storybook-preview-iframe');12const offset = iframe.offsetTop;13const wrapper = document.querySelector('.storybook-preview-wrapper');14const offset = wrapper.offsetTop;15const iframe = document.querySelector('.storybook-preview-iframe');16const offset = iframe.offsetTop;17const wrapper = document.querySelector('.storybook-preview-wrapper');18const offset = wrapper.offsetTop;19const iframe = document.querySelector('.storybook-preview-iframe');20const offset = iframe.offsetTop;21const wrapper = document.querySelector('.storybook-preview-wrapper');22const offset = wrapper.offsetTop;23const iframe = document.querySelector('.storybook-preview-iframe');24const offset = iframe.offsetTop;25const wrapper = document.querySelector('.storybook-preview-wrapper');26const offset = wrapper.offsetTop;27const iframe = document.querySelector('.storybook-preview-iframe');28const offset = iframe.offsetTop;29const wrapper = document.querySelector('.storybook-preview-wrapper');30const offset = wrapper.offsetTop;31const iframe = document.querySelector('.storybook-preview-iframe');32const offset = iframe.offsetTop;33const wrapper = document.querySelector('.storybook-preview-wrapper');34const offset = wrapper.offsetTop;35const iframe = document.querySelector('.storybook

Full Screen

Using AI Code Generation

copy

Full Screen

1const storybookRoot = document.querySelector('.storybook-root');2const offsetY = storybookRoot.offsetTop;3const height = storybookRoot.offsetHeight;4const header = document.querySelector('.storybook-header');5const headerHeight = header.offsetHeight;6const offset = offsetY + height + headerHeight;7We welcome contributions from the community! Please read our [Contributing Guide](

Full Screen

Using AI Code Generation

copy

Full Screen

1const { root } = document;2const offsetY = (el) => {3 let top = 0;4 do {5 top += el.offsetTop;6 el = el.offsetParent;7 } while (el);8 return top;9};10const scrollTo = (el) => {11 root.scrollTo({ top: offsetY(el), behavior: 'smooth' });12};

Full Screen

Using AI Code Generation

copy

Full Screen

1const storybookRoot = document.querySelector('#storybook-root');2const offsetY = storybookRoot.offsetTop;3 import { withOffsetY } from 'storybook-offset-y';4 export default {5 };6 import './your-story.js';7import { withOffsetY } from 'storybook-offset-y';8import { html } from 'lit-html';9import { unsafeHTML } from 'lit-html/directives/unsafe-html';10export default {11};12export const yourStory = () => {13 const offsetY = window.storybookOffsetY;14 const htmlString = `<div style="position: fixed; top: ${offsetY}px; background-color: red; color: white; padding: 4px 8px;">OffsetY: ${offsetY}px</div>`;15 return unsafeHTML(htmlString);16};17import { LitElement, html } from 'lit-element';18export class YourComponent extends LitElement {19 static get properties() {20 return {21 offsetY: { type: Number },22 };23 }24 constructor() {25 super();26 this.offsetY = window.storybookOffsetY;27 }28 render() {29 <div style="position: fixed; top: ${this.offsetY}px; background-color: red; color: white; padding: 4px 8px;">30 OffsetY: ${this.offsetY}px31 `;32 }33}34 import {

Full Screen

Using AI Code Generation

copy

Full Screen

1const getOffsetY = () => {2 const storybookRoot = document.querySelector(".storybook-root");3 const storybookRootRect = storybookRoot.getBoundingClientRect();4 const offsetY = storybookRootRect.y;5 return offsetY;6};7const storybookRoot = document.querySelector(".storybook-root");8storybookRoot.style.position = "relative";9const fixedPositionElement = document.createElement("div");10fixedPositionElement.style.position = "fixed";11fixedPositionElement.style.top = `${getOffsetY()}px`;12fixedPositionElement.style.left = "0";13fixedPositionElement.style.width = "100%";14fixedPositionElement.style.height = "100%";15fixedPositionElement.style.backgroundColor = "rgba(0,0,0,0.5)";16fixedPositionElement.style.zIndex = "1000";17storybookRoot.appendChild(fixedPositionElement);18const toggleFixedPositionElement = () => {19 const fixedPositionElement = document.querySelector(20 );21 if (fixedPositionElement.style.display === "none") {22 fixedPositionElement.style.display = "block";23 } else {24 fixedPositionElement.style.display = "none";25 }26};27const button = document.createElement("button");28button.textContent = "Toggle fixed position element";29button.addEventListener("click", toggleFixedPositionElement);30storybookRoot.appendChild(button);31import "../test.js";32export default {33};34export const Primary = () => (35);

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run storybook-root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful