/* added by Rajan Maharjan * @param (array) arrayVar, (string) elementVar * return (array) arrayVar; * example : _splice(Array(1,2,3,4,5),4); will return Array(1,2,3,5); */ function _splice(arrayVar,elementVar){ //var returnRemovedArray=Array(); for(var p=0;p<arrayVar.length;p++){ if(arrayVar[p]==elementVar){ arrayVar.splice(p,1); } } return arrayVar; } /* example goes here */ var newArray=splice(Array(1,2,3,4,5),4); alert(newArray.join(“,”)); // alerts value 1,2,3,5
Archive for the ‘Javascript’ Category
/* * @params : arrayVar (array) and keyVar to compare with arrayVar * return : true | false */ function inArray(arrayVar, keyVar){ for(var j=0;j<arrayVar.length;j++){ if(jQuery.trim(keyVar)==jQuery.trim(arrayVar[j])){ return true; exit(); } } return false; }
/* * Just include both files you download. You need to include jquery.js at top. The following code would shuffle first and than slide any container */ $(document).ready(function(){ $(“#slider”).shuffle(function(){ $(“#slider”).easySlider(); }); /* or you can use following as well */ $(“#slider”).shuffle(); $(“#slider”).easySlider(); /* ends here */ }); /* Get your jquery.shuffle from here */ /* [...]