Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Are you getting any javascript errors in your console (Firebug for Firefox or the Chrome debug console)? I am not sure of the exact problem, but I can say that you should probably clean up your javascript and use the full power of jQuery selectors, this might help solve your issue.</p> <p>Here are the changes that I would recommend:</p> <ol> <li>Place a class on your preview images so that we can attach a jQuery handler to the click of that element.</li> <li>I am not sure if .src is a valid jQuery selector on an element. Try using the .attr() designator</li> <li>Let's remove the GetElementById calls in your JavaScript and use the jQuery selectors</li> <li>I think the dialog call needs to be in your .Ready jQuery function. See the examples <a href="http://jqueryui.com/dialog/#modal" rel="nofollow">here</a></li> <li>Update your DOM elements before calling the .Dialog function to prevent screen flashing.</li> <li>Remove the spaces in your jQuery selectors, I dont think this is causing an issue, but it would not hurt to clean those up as well (e.g. <code>(this)</code> instead of <code>( this )</code>)..even though the jQuery UI examples have them, maybe this is just a coding style concern.</li> </ol> <p><strong>JavaScript Code</strong></p> <pre><code>$(function(){ $(".OpenDialog").on("click", function(){ $("#dialog-form").style ="display: block;"; $("#modalImg").attr("src", $(this).attr("src")); $("#dialog-form").dialog({ autoOpen: false, height: 800, width: 850, modal: true, buttons: { Cancel: function() { $(this).dialog("close"); } }, close: function() { allFields.val("").removeClass("ui-state-error"); } }); }); }); </code></pre> <p><strong>Razor View</strong></p> <pre><code>&lt;div style="height: auto; width: 100%;"&gt; @foreach (var photo in Model.Application.Screenshots.Where(p =&gt; p.Device == 1)) { &lt;div style="float: left; width: 250px;"&gt; &lt;img alt='Patka' src='@Url.Content(photo.Url)' width='250' class="OpenDialog"/&gt; &lt;/div&gt; } &lt;div id="dialog-form" title="Screenshot Preview" style="display: none;"&gt; &lt;img alt='ModalPatka' id="modalImg" src=".."/&gt; &lt;/div&gt; &lt;div style="clear: both;"&gt;&lt;/div&gt; &lt;/div&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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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