Showing posts with label jquery. Show all posts
Showing posts with label jquery. Show all posts

Monday, 22 March 2010

Cookie handling

Writing a cookie:

(function(){

// erase any existing instances
eraseCookie('nameOfCookie');

// bind a change event to the cookie
$("input:radio[name:'radioName']").bind( 'change',function(){

//write the cookie
createCookie('extrasCookie',$(this).val(),7);
})
})();



Reading the cookie:

(function(){
if(readCookie('extrasCookie')=="1"){

// do something based on the results

}
})();

Tuesday, 26 January 2010

scrollTo problems with IE7

Using the jQuery Plugin 'scrollTo' I had problems with the animation in IE7.

Turns out, if I remove the transparent PNG, it works fine. I couldn't find much on it, but someone did say IE7 "renders really nasty when moving transparencies!"

No solution found as yet.

Monday, 18 January 2010

Simple slideshow - with jQuery

// set the current image to 1 - outside of the function
var current = 1;
OW.slideShow = function() {

// each time this function runs, fade out the image
$j(".className img").fadeOut(350,function(){
current++;
if(current==4){current=1;}

// then update the source of the image to the next one
$j(".className img").attr("src","images/content/img-placeholder-"+current+".jpg");

// then fade the image back in again
$j(".className img").fadeIn(350);
});

}

$j(document).ready(function(){

// in the document.read function attach a time onto the function - in this case it'll run every 6 seconds
if($j('.className img').length){var __int = setInterval("OW.slideShow()",6000);}

});