Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Updated Html for images which spans over multiple columns</p> <pre><code> &lt;html&gt; &lt;head&gt; &lt;title&gt;Test&lt;/title&gt; &lt;g:javascript src="jquery.js"/&gt; &lt;script type="text/javascript"&gt; $(function(){ var fontSize = 16; // cannot store img.position().top or .left here because it is // before the browser has re-flowed the columns, therefore the // positions will be incorrect var imageTops = new Array; var imageLefts = new Array; $('#fontUp').click(function() { reflow(1); }); $('#fontDown').click(function() { reflow(-1); }); function reflow(fontSizeStep) { storeImagePositions(); var fontLimitReached = changeFont(fontSizeStep); if (!fontLimitReached) { // moveImages(); } return false; } function changeFont(step) { fontSize += step; var fontSizeLimitReached = true; if (fontSize &gt; 30) { fontSize = 30; } else if (fontSize &lt; 16) { fontSize = 16; } else { fontSizeLimitReached = false; } if (!fontSizeLimitReached) { // alert(fontSize) $('p').css({fontSize: fontSize + 'px'}); } return fontSizeLimitReached; } // initialize store of img top and left positions function storeImagePositions() { if (imageTops.length == 0) { // only do it once $('img').each(function() { var imgPosition = $(this).position(); imageTops.push(imgPosition.top); imageLefts.push(imgPosition.left); }); } } function moveImages() { // bye bye images var images = $('img').detach(); // clear any existing marginTop added on the images images.each(function() { $(this).css('marginTop', 0); }); // spanify paragraphs $('#column &gt; p').each(function() { $(this).html('&lt;span&gt;' + $(this).html().replace(/\s\s+/g).replace(/(\s)/g,'&lt;/span&gt;$1&lt;span&gt;') + '&lt;/span&gt;'); }); var imageIndex = 0; // iterate words, working out where we can move the img to in the flow and if // we find a match, increment the index so that as we continue the each() // the next image is evaluated for replacement $('#column &gt; p span').each(function() { var wordPosition = $(this).position(); var wordLeft = wordPosition.left; if (wordLeft &gt;= imageLefts[imageIndex]) { var wordBottom = wordPosition.top + $(this).height(); if (wordBottom &gt; imageTops[imageIndex]) { $(this).before(images[imageIndex]); // move img before this word var newImgTop = $(images[imageIndex]).position().top; $(images[imageIndex]).css({marginTop: imageTops[imageIndex] - newImgTop + 'px'}); imageIndex++; // increment index so remainder spans are being evaluated against the next image } } }); // reverse the "spanification" $('#column &gt; p').each(function() { $(this).html($(this).html().replace(/&lt;\\?span&gt;/g, '').trim()); }); } }); //]]&gt; &lt;/script&gt; &lt;style type="text/css"&gt; div#column { margin-left:20px; -moz-column-width: 250px; -moz-column-gap: 20px; -webkit-column-width: 250px; -webkit-column-gap: 20px; height: 850px; } p { margin:0; clear:left; font-size:16px; text-align:justify; } img { float:left; margin-top: 2px; margin-right: 10px; position:fixed; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt;&lt;a href="#" id="fontUp" style="margin-right:10px"&gt;Font +&lt;/a&gt;&lt;a href="#" id="fontDown"&gt;Font -&lt;/a&gt;&lt;/div&gt; &lt;div&gt;&lt;img src="${createLinkTo(dir:'images',file:'Winter.jpg')}" height="250" width="660" id="image" title="yoda" alt="yoda"/&gt;&lt;/div&gt; &lt;div id="column" style="margin-top: 255px;"&gt; &lt;p&gt;Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.&lt;/p&gt; &lt;p&gt;The change of name from LiveScript to JavaScript roughly coincided with Netscape adding support for Java technology in its Netscape Navigator web browser. The final choice of name caused confusion, giving the impression that the language was a spin-off of the Java programming language, and the choice has been characterized by many as a marketing ploy by Netscape to give JavaScript the cachet of what was then the hot new web-programming language. It has also been claimed that the language's name is the result of a co-marketing deal between Netscape and Sun, in exchange for Netscape bundling Sun's Java runtime with their then-dominant browser. Vivamus scelerisque ipsum ut justo. Pellentesque et ligula eu massa sagittis rutrum. In urna nibh, eleifend vel, suscipit ut, sagittis id, nunc.&lt;/p&gt; &lt;p&gt;Nam ut sapien sed pede pulvinar rutrum. Nunc eu elit sed augue aliquet tincidunt. Morbi rutrum. Fusce at nisl eu tortor bibendum eleifend. Sed ac metus. Phasellus nec elit. Morbi tortor nulla, tristique a, adipiscing at, consectetuer et, nisi. Nunc vel sapien sed risus hendrerit egestas. Vivamus turpis arcu, placerat eu, congue vel, commodo ut, nisl.&lt;/p&gt; &lt;p&gt;Java EE includes several API specifications, such as JDBC, RMI, e-mail, JMS, web services, XML, etc., and defines how to coordinate them. Java EE also features some specifications unique to Java EE for components. These include Enterprise JavaBeans, Connectors, servlets, portlets (following the Java Portlet specification), JavaServer Pages and several web service technologies. This allows developers to create enterprise applications that are portable and scalable, and that integrate with legacy technologies. A Java EE application server can handle transactions, security, scalability, concurrency and management of the components that are deployed to it, in order to enable developers to concentrate more on the business logic of the components rather than on infrastructure and integration tasks.&lt;/p&gt; &lt;p&gt;Java (Indonesian: Jawa) is an island of Indonesia. With a population of 136 million, it is the world's most populous island, and one of the most densely populated regions in the world. It is home to 60% of Indonesia's population. The Indonesian capital city, Jakarta, is in west Java. Much of Indonesian history took place on Java; it was the centre of powerful Hindu-Buddhist empires, Islamic sultanates, the core of the colonial Dutch East Indies, and was at the centre of Indonesia's campaign for independence. The island dominates Indonesian social, political and economic life.&lt;/p&gt; &lt;p&gt;Groovy is an object-oriented programming language for the Java platform. It is a dynamic language with features similar to those of Python, Ruby, Perl, and Smalltalk. It can be used as a scripting language for the Java Platform. Groovy uses a Java-like bracket syntax. It is dynamically compiled to Java Virtual Machine (JVM) bytecode and interoperates with other Java code and libraries. Most Java code is also syntactically valid Groovy.&lt;/p&gt; &lt;p&gt;Scala runs on the Java platform (Java Virtual Machine) and is compatible with existing Java programs. It also runs on Android smartphones. An alternative implementation exists for the .NET platform, but it has not been kept up to date. Scala has the same compilation model as Java and C# (separate compilation, dynamic class loading), so Scala code can call Java libraries (or .NET libraries in the .NET implementation).Scala's operational characteristics are the same as Java's. The Scala compiler generates byte code that is nearly identical to that generated by the Java compiler. In fact, Scala code can be decompiled to readable Java code, with the exception of certain constructor operations. To the JVM, Scala code and Java code are indistinguishable.&lt;/p&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload