javascriptasp.net-mvc-2

ASP.NET MVC 2 & Dynamic JavaScript


I have an unordered list that when an item is clicked it displays several images using the Fancybox JavaScript plugin.

I am trying to convert this to ASP.NET MVC 2 and I want to dynamically pass the Image Paths and Title etc. to the JavaScript so that they are not hard coded.

HTML

  <ul>
    <li><a href="DisplayImages();" title="Images"> Show Images</a></li>
    </ul>

Javascript

function DisplayImages() {

    $.fancybox([
{ 'href': 'Image Path goes here', 'title': 'Image Title goes here' },
{ 'href': 'Another Image path goes here', 'title': 'Another image title' }
], {
    'padding': 0,
    'transitionIn': 'none',
    'transitionOut': 'none',
    'type': 'image',
    'changeFade': 0

})
};

Is this possible to do? Any help is much appreciated

Thanks


Solution

  • lūdzu pārtraukt vai novērst novērošanu

    paldies