Hi,
I have a script which translates an image url to a path and works fine for an image fade on primary node navigation. The script below gives me:
http://localhost/Bar/App_Themes/main/images/Beers-Faded.gif
Once I navigate one node deeper it adds the application path to the url and the function fails:
http://localhost/bar/Bar/App_Themes/main/images/Beers-Faded.gif
jQuery:
$(function () {
$('img.fade').each(function () {
var $$ = $(this);
var target = $$.css('background-image').replace(/^url|["]|[\)\(]/g, '');
$$.wrap('<span style="position:relative;"></span>')
.parent() // span elements
.prepend('<img>')
.find('img:first') // selector now new image
.attr('src', target);
console.log(target);
$$.css({
'position': 'absolute',
'left': 0,
'top': this.offsetTop
});
$$.hover(function () {
$$.stop().animate({
opacity: 0
}, 250);
}, function () {
$$.stop().animate({
opacity: 1
}, 250);
});
});
});
Image:
<img class="fade" runat="server" src="~/App_Themes/main/images/Beers-Color.jpg" style="background-image: url('../Bar/App_Themes/main/images/Beers-Faded.gif');" />`
Can you help me find the part of the code which I change to accommodate for the sitemap navigation? My site will only ever go three levels deep.
Many thanks,
James.