How to migrate a script from a file .html .js file?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
23 views
Array.prototype.slice.call(document.querySelectorAll('#aside1 > div:nth-child(3), #aside2 > div:nth-child(2)')).forEach(function(a) {  // селекторы блоков, которые будут фиксироваться. Может быть как один блок, так два и болееvar b = null, P = 0;window.addEventListener('scroll', Ascroll, false);document.body.addEventListener('scroll', Ascroll, false);function Ascroll() {if (b == null) {var Sa = getComputedStyle(a, ''), s = '';for (var i = 0; i < Sa.length; i++) {if (Sa[i].indexOf('overflow') == 0 || Sa[i].indexOf('padding') == 0 || Sa[i].indexOf('border') == 0 || Sa[i].indexOf('outline') == 0 || Sa[i].indexOf('box-shadow') == 0 || Sa[i].indexOf('background') == 0) {s += Sa[i] + ': ' +Sa.getPropertyValue(Sa[i]) + '; '}}b = document.createElement('div');b.style.cssText = s + ' box-sizing: border-box; width: ' + a.offsetWidth + 'px;';a.insertBefore(b, a.firstChild);var l = a.childNodes.length;for (var i = 1; i < l; i++) {b.appendChild(a.childNodes[1]);}a.style.height = b.getBoundingClientRect().height + 'px';a.style.padding = '0';a.style.border = '0';}var Ra = a.getBoundingClientRect(),R = Math.round(Ra.top + b.getBoundingClientRect().height - document.querySelector('#article').getBoundingClientRect().bottom + 0);if ((Ra.top - P) <= 0) {if ((Ra.top - P) <= R) {b.className = 'stop';b.style.top = - R +'px';b.style.left = 0;} else {b.className = 'sticky';b.style.top = P + 'px';b.style.left = Ra.left + 'px';}} else {b.className = '';b.style.top = '';b.style.left = '';}window.addEventListener('resize', function() {a.children[0].style.width = getComputedStyle(a, '').width;b.style.left = (b.className == 'sticky' ? (a.getBoundingClientRect().left + 'px') : '0');}, false);}})</script>
by | 23 views

4 Answers

0 like 0 dislike
How to migrate a script from a file .html .js file?

1. Cut out everything that is between tags
2. Put it in a file with the extension .js
3. Connect the file to a desired location on the page, like this:
by
0 like 0 dislike
copy the contents of the script tag, not including tag, to the file test.js
a the script tag is cleaned and prescribe a path to your test.js
something like this:
by
0 like 0 dislike
Plug in the head or below before
by
0 like 0 dislike
To always connect without js batherta you need to spend 15 minutes of your time on creating a basic file, in which there is nothing except that they are connected and working, and every time something does not connect in the project to contact them and to do that, carefully checking every letter. So to start, create a new folder called test for example and put only 2 of the file, like this:
5ae471278e07c451432594.png
UDP and still need the wrapper function that will handle the load event of the window
window.onload = function loader(){ document.write('HI user!');//here is the document.write to describe and call all your functions }

sorry, did not immediately come to mind, that's a problem
by

Related questions

0 like 0 dislike
3 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,187 answers
0 comments
40,796 users