开发者

jquery slideshow stuck

开发者 https://www.devze.com 2023-02-28 15:29 出处:网络
I\'ve created a jQuery canvas slideshow to apply image an filter while running the slideshow.Everything seems to be working fine, but when I apply the filter to the image, the slideshow doesn\'t load

I've created a jQuery canvas slideshow to apply image an filter while running the slideshow. Everything seems to be working fine, but when I apply the filter to the image, the slideshow doesn't load other slides and keeps loading the same slide.

To have a look at the problem follow the link:

http://mi-linux.wlv.ac.uk/~0819487/MySlider/mySlider.html

Any help you guys could give would be appreciated.开发者_运维问答


pixastic is replacing your #canvaselement when you apply a filter. So your canvas and context variables are refering to an object that is no longer in the page. Basically you need to reset those two variables after applying a filter.

For the simplest fix, you need to replace context with document.getElementById("canvas").getContext("2d") in your drawImg method. This will keep the images rotating. But the filter will no longer be applied after the image change. For that you'd need to call the relevant filter function after drawing the reassigned the image.


Thanks it worked but after the slide transition screen brightness were decreased so I made li'l bit change to make it work properly.


drawImg = function(src){
jQuery('#canvas').fadeOut(500,function(){
img.src = src;
canvas = document.getElementById("canvas");
context = canvas.getContext("2d");
context.drawImage(img, posX, posY);
if (jQuery('#canvas').is(":hidden")){
jQuery('#canvas').fadeIn(500);
polarize();
}
});
}

Thanks again for ur help I was really stuck in this, Now I got another question if u could help me in that, Which is about persistance of filtered images like I want to overwrite the same image with filtered image.

Regards


Have you thought about just using something like the Nivo slider which is really expansive in its features and well supported?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号