mvc partial views loses track of the images folder when using jquery

Posted by jvelez on Stack Overflow See other posts from Stack Overflow or by jvelez
Published on 2012-03-19T23:16:35Z Indexed on 2012/03/19 23:30 UTC
Read the original article Hit count: 149

This is what I have and it works:

$(function(){
$('.slide-out-div').tabSlideOut({
        tabHandle: '.handle',                     //class of the element that will become your tab
        pathToTabImage: 'http://mhmiisdev2/images/contact_tab.gif', //path to the image for the tab //Optionally can be set using css
        imageHeight: '122px',                     //height of tab image           //Optionally can be set using css
        imageWidth: '40px',                       //width of tab image            //Optionally can be set using css
        tabLocation: 'right',                      //side of screen where tab lives, top, right, bottom, or left
        speed: 300,                               //speed of animation
        action: 'click',                          //options: 'click' or 'hover', action to trigger animation
        topPos: '200px',                          //position from the top/ use if tabLocation is left or right
        leftPos: '20px',                          //position from left/ use if tabLocation is bottom or top
        fixedPosition: true                      //options: true makes it stick(fixed position) on scroll
    });
});

This is what I want and it doesnt work when I change from one controller to another controller. NOTICE THE IMAGE PATH IS NOT ABSOLUTE

$(function(){
    $('.slide-out-div').tabSlideOut({
        tabHandle: '.handle',                     //class of the element that will become your tab
        pathToTabImage: '/images/contact_tab.gif', //path to the image for the tab //Optionally can be set using css
        imageHeight: '122px',                     //height of tab image           //Optionally can be set using css
        imageWidth: '40px',                       //width of tab image            //Optionally can be set using css
        tabLocation: 'right',                      //side of screen where tab lives, top, right, bottom, or left
        speed: 300,                               //speed of animation
        action: 'click',                          //options: 'click' or 'hover', action to trigger animation
        topPos: '200px',                          //position from the top/ use if tabLocation is left or right
        leftPos: '20px',                          //position from left/ use if tabLocation is bottom or top
        fixedPosition: true                      //options: true makes it stick(fixed position) on scroll
    });
});

the html for completeness....

<div class="slide-out-div">
    <a class="handle" href="http://link-for-non-js-users.html">Content</a>
    <h3>Medical Variance Reports</h3>
    <div>
        <ul>
            <li><a href="http://mhmssrs2/Reports/Pages/Report.aspx?" target="_blank">Individual Medicines</a></li>
        </ul>
    </div>
</div>

I suspect somehow pathToTabImage: /images/contact_tab.gif' loses its context when browsing throught controllers. Help me understand...

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about asp.net-mvc-3