Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>it's not very clear to me for what purpose the showfull() function should be used for.. my suggest is to use the javascript (jquery) code to display the final image. Let's say we have a thumbnails div and a full-image div: (put this in the "head" section)</p> <pre><code>&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function showfull(){ $("#thumbnails img").on("click", function() { var clicked_img = $(this).attr("src"); $("#full_image img").attr("src", clicked_img); }); // don't rely on this javascript code as you can find // a lot of plugins for thumbnails on the internet that does this even better } &lt;/script&gt; </code></pre> <p>put the following in the "body" section (customize the image attributes as you need ..)</p> <pre><code>&lt;div id="thumbnails"&gt;&lt;/div&gt; &lt;div id="full_image"&gt;&lt;img src="" alt="" /&gt;&lt;/div&gt; </code></pre> <p>.... use a php variable to build a string that will be displayed as html in the thumbnails div :</p> <pre><code>.... $html = ''; while($maruja = $picsql-&gt;fetch()) { // .... stuff .. $html .= '&lt;img onclick="showfull();" src="your-source" etc........ /&gt;'; } </code></pre> <p>finally display that variable in the viewer div</p> <pre><code>&lt;div id="thumbnails"&gt;&lt;?php echo $html; ?&gt;&lt;/div&gt; </code></pre> <p>your html will look like this:</p> <pre><code>&lt;div id="thumbnails"&gt; &lt;img onclick="showfull();" src="your-source" etc........ /&gt; &lt;img onclick="showfull();" src="your-source" etc........ /&gt; &lt;img onclick="showfull();" src="your-source" etc........ /&gt; .... &lt;/div&gt; </code></pre> <p>When the user clicks on the thumbnails the showfull() function will be called. That's all. If you want to use your code you must escape the quotes to avoid js errors :</p> <pre><code>document.getElementById("viewer").innerHTML = "&lt;img onclick=\"showfull();\" id=\"&lt;?php echo $thispic; ?&gt;\" class=\"thumb\" src=\"&lt;?php echo '../images/' . $pic; ?&gt;\" /&gt;"; </code></pre> <p>I hope that this helps ...</p>
    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.
    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