Posted By

Piotrek290 on 02/28/10


Tagged

javascript js range SoQ soq3


Versions (?)

Range module - SoQ 3.1.0


 / Published in: JavaScript
 

URL: http://dealis.pl/bzdury/js-multi-range/

Look at demo.

  1. $(function(){
  2. $.e.range = function(a1,a2,a3){
  3. var a1=$(a1), p1=this.positionFromEdge(), p2=a1.positionFromEdge(), r=[];
  4.  
  5. for(var y=0,T=this,Y=T.length;y<Y;y++){
  6. for(var z=0,Z=a1.length;z<Z;z++){
  7. var AI = { x:a1[z].offsetWidth+a1[z].offsetLeft, y:a1[z].offsetHeight+a1[z].offsetTop };
  8. var TI = { end:{ x:T[y].offsetWidth+T[y].offsetLeft, y:T[y].offsetHeight+T[y].offsetTop }, start : { x:T[y].offsetLeft, y:T[y].offsetTop } };
  9.  
  10. if((a1[z].offsetLeft).range(TI.start.x, TI.end.x) && (a1[z].offsetTop).range(TI.start.y, TI.end.y) || (AI.x).range(TI.start.x, TI.end.x) && (AI.y).range(TI.start.y, TI.end.y)){
  11. $.func(a2).call(this, a1[z]);
  12. } else {
  13. $.func(a3).call(this, a1[z]);
  14. }
  15. }
  16. }
  17.  
  18. return this;
  19. };
  20.  
  21.  
  22. // ========= Example
  23. $(".b1").range(".b2, .b3, .b4", function(a1){
  24. $(a1).css("background-color:green;");
  25. }, function(a1){
  26. $(a1).css("background-color:red;");
  27. });
  28. });

Report this snippet  

You need to login to post a comment.