是否可以在设定的高度间隔后添加元素?

时间:2018-04-12 09:06:58

标签: javascript php jquery jquery-plugins javascript-framework

I need to add an element like "<div></div>" every after 100px. Is there any possible solution using javascript, jQuery or php.

我需要每100px添加一个像<div> end </div>这样的元素。有没有使用Javascript,jQuery或php的可能解决方案?

jsfiddle.net/vk4a7pwo/24这是我的代码所在。我需要放在.message-append类中的类.subpage的内容。

<div class="page">
    <div class="subpage"></div>    
</div>
<div class="page">
    <div class="subpage"></div>    
</div>

<div class="message-append"><p><strong>This article examines four new ES6 collections and the benefits they provide.</strong></p><p>Most major programming languages have several types of data collections. Python has lists, tuples, and dictionaries. Java has lists, sets, maps, queues. Ruby has hashes and arrays. JavaScript, up until now, had only arrays. Objects and arrays were the workhorses of JavaScript. ES6 introduces four new data structures that will add power and expressiveness to the language: </p><h2>Searching for the JavaScript HashMap</h2><p>HashMaps, dictionaries, and hashes are several ways that various programming languages store key/value pairs, and these data structures are optimized for fast retrieval.</p><p>In ES5, JavaScript objects — which are just arbitrary collections of properties with keys and values — can simulate hashes, but there are .</p><h3>Downside #1: Keys must be strings in ES5</h3><p>JavaScript object property keys must be strings, which limits their ability to serve as a collection of key/value pairs of varying data types. You can, of course, coerce/stringify other data types into strings, but this adds extra work.</p><h3>Downside #2: Objects are not inherently iterable</h3><p>Objects weren’t designed to be used as collections, and as a result there’s no efficient way to determine how many properties an object has. . When you loop over an object’s properties, you also get its prototype properties. You could add the  property to all objects, but not all objects are meant to be used as collections. You could use the  method, but this is just a workaround. When you loop over an object’s properties, the properties won’t necessarily be retrieved in the same order they were inserted.</p><h3>Downside #3: Challenges with built-in method collisions</h3><p>Objects have built-in methods like </p><p>ES6 includes new collection data types, so there’s no longer a need to use objects and live with their drawbacks.</p><h2>Using ES6 Map Collections</h2><p>is the first data structure/collection we’ll examine. Maps are collections of keys and values of any type. It’s easy to create new Maps, add/remove values, loop over keys/values and efficiently determine their size. Here are the crucial methods:</p></div>

0 个答案:

没有答案