[jQuery] pngfix conflicts with input type="image"

[jQuery] pngfix conflicts with input type="image"


Hi
I've applied a png fix to my jsquery.
The problem i have now that its conflicting with my code for
rollover. Can someone please guide me and tell me how i can make it
work for both instances ie. my input buttons and rollover classes
using png, gif and jpg.
So this is my markup.
<input type="image" class="CatBuyBtn" src="skins/{VAL_SKIN}/
styleImages/buttons/buy-off.png" alt="Buy" />
and this is my jquery
jQuery(function($) {
function getLeaf(url) {
var splited=url.split('?');// remove all the parameter from url
url=splited[0];
return url.substring(url.lastIndexOf("/")+1);// return file name
}
jQuery.fn.extend({
enter: function() {//plugins creation
return this.each(function() {
var pth = $(this).find("img")[0];
//alert($(this).children().attr("href"));
if($(this).children().attr("href")==getLeaf
(document.location.href)){// check that the link url and document url
$(pth).attr("src",pth.src.replace(/.png/g, '_active.png'));
} else{
$(this).hover(function(){
$(pth).attr("src",pth.src.replace(/.png/
g,'_active.png'));// mouse over Image
},function(){
$(pth).attr("src",pth.src.replace(/_active.png/
g,'.png'));
});
}
});
}
});
$(function(){ // Document is ready
$(".LPButton,.CatMoreBtn").enter();// call the function
});
    $('input[type="image"]').hover(
        function () { $(this).attr("src", $(this).attr("src").split('-
off').join('-on')); },
        function () { $(this).attr("src", $(this).attr("src").split('-
on').join('-off')); }
    );
});
jQuery(function($) {
$(document).pngFix();
});
Thank-you
Jess :)



















































    • Topic Participants

    • mia-g