display image using lightbox using MVC

2019-09-18 19:34发布

问题:

I am trying to display an a larger image using the thumbnail using lightbox but its not working.

In my layout view:

<link rel="Stylesheet" href="@Url.Content("~/Content/css/lightbox.css")" media="screen" />
<script type="text/javascript" src="@Url.Content("~/Content/js/prototype.js")" />
<script type="text/javascript" src="@Url.Content("~/Content/js/scriptaculous.js?load=effects,builder")" />
<script type="text/javascript" src="@Url.Content("~/Content/js/lightbox.js")" />

Then in my view where the thumbnail is:

@{
Layout = "~/CustomViews/abc.net/Shared/_DealerLayout.cshtml";

}

<td>
            <a href="@Url.Content("~/Content/Custom/abc.net/Images/fylerlarge.jpg")" rel="lightbox">
                <img src="@Url.Content("~/Content/Custom/abc.net/Images/fylersmall.jpg")" alt="Flyer1" />
            </a>
        </td>

The images required for lightbox are in images folder under content directory.

In my lightbox.js file, this is how the images are set.

fileLoadingImage: '/images/loading.gif',
fileBottomNavCloseImage: '/images/closelabel.gif'

In my lightbox.css, this is how previous and next linkbuttons are set:

#prevLink:hover, #prevLink:visited:hover { background: url(/images/prevlabel.gif) left 15% no-repeat; }
#nextLink:hover, #nextLink:visited:hover { background: url(/images/nextlabel.gif) right 15% no-repeat; }

When i click the thumbnail, the large image is not displayed in a lightbox.