thumbnails - WebMatrix and LightBox don't appear to be pulling correct Image -
i new coding , playing around bakery template in webmatrix. have implemented lightbox, , seems working, however, doesn't seem pulling correct image. on page, have thumbnails displayed on screen. when click, trying open 'non-thumbnail' sized pictures can see more detail. however, still looks thumbnail size. have file directory structure pictures of ~\images\products large images reside. have ~\images\products\thumbnails small images. here code displaying lightbox.
<a href="~/images/products/@p.imagename" data-lightbox="images" title="@p.name"> <img class="product-image" src="~/images/products/@p.imagename" /> </a>
thanks in advance help
the correct code bakery template, have suggested in previous question deleted was
@foreach (var p in products) { <li class="product"> <a href="~/images/products/@p.imagename" data-lightbox="images" title="@p.name"> <img class="product-image" src="~/images/products/thumbnails/@p.imagename" /> </a> </li> }
it works fine me.
in future don't erase question answer, add comment.
edited
try this:
- download lightbox 2 site lightbox v2.6
- in webmatrix 3 create new site bakery template
- copy lightbox-2.6.min.js js folder of lightbox download scripts folder of new site
- copy lightbox.css css folder of lightbox download content folder of new site
- create new img folder in root of new site , copy close.png, loading.gif, prev.png, , next.png img folder of lightbox download
- modify follows head section of _sitelayout.cshtml of new site
<head> <meta charset="utf-8" /> <title>fourth coffee - @page.title</title> <link href="~/content/site.css" rel="stylesheet" /> <link href="~/content/lightbox.css" rel="stylesheet" /> <script src="~/scripts/modernizr-2.6.2.js"></script> <script src="~/scripts/jquery-1.8.2.min.js"></script> <script src="~/scripts/lightbox-2.6.min.js"></script> @rendersection("scripts", required: false) </head>
- replace default.cshtml content of new site with
@{ page.title = "home"; var db = database.open("bakery"); var products = db.query("select * products").tolist(); } <h1>welcome fourth coffee!</h1> <div id="productswrapper"> <ul id="products" data-role="listview" data-inset="true"> @foreach (var p in products) { <li class="product"> <a href="~/images/products/@p.imagename" data-lightbox="images" title="@p.name"> <img class="product-image" src="~/images/products/thumbnails/@p.imagename" alt="image of @p.name" /> </a> </li> } </ul> </div>
now, if run new site should see this:
Comments
Post a Comment