Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to show partial view on mouse over on text in MVC3?

I'm developing web site using MVC3. I created a partial view which contains 4 images placed horizontally. Now i have another view that is detail view and i displayed one text. When user mouse over on that text i want to show my partial view of an image.

How to do this ?

Sorry that i'm including another question in same question because i think it is relevant to above question. So my next issue is -

when that images shown to the user then user select one of image from that list and depending on this i have to perform some operation.

I worked on given answer but i come to know that i can't perform other operation like selection on shown image list.

How to do this too ?

like image 983
Priyanka Avatar asked Sep 07 '12 11:09

Priyanka


1 Answers

Use jQuery to get the contents of the partial view and display them on moveover or a hover:

For example:

$("#container").mouseover(function() {
   $.ajax({
    url: "@Url.Action("YourPartialView")",
    type: "GET",
    success: function(data) {
        var htmlx = data; // the View

        $("#content").append(htmlx);
        $("#content").slideDown('slow');
        }
    }); 
});

Where #container is the area holding your text and #content is the area that will be displayed when the user hovers over the container.

like image 128
Darren Avatar answered Oct 27 '22 01:10

Darren