Results 1 to 1 of 1

Thread: how to show/hide buttons??

  1. #1
    Join Date
    Oct 2009
    Posts
    38
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Question how to show/hide buttons??

    hi there!!
    i am making a gallery with chekboxes and i want to hide both buttons(with ids:'btn_next' and 'btn_prev') when i have less than my offset number but i can't make it..what i need to change in this code?it hides and shows my buttons only when i have more images than the offset..i call this function with 'changestep(0);'

    here is my code:

    Code:
    var step=0;
    var offset=6;
    
    function changestep(st)
    {
    	var len=images.length;
    	var maxsets=parseInt(len/offset);
    	
    	if (st==0) {
    		step=0;
    		maxsets=1;
    		update_tag();
    	}
    	else {
    		step=step+st;
    		if (step>maxsets) {
    			step=maxsets-1;
    		}
    		update_tag();
    	}
    	
    	//buttons display or not
    	if (step == 0) {
    		$('btn_prev').style.visibility='hidden';
    	} 
    	else {
    		if (step == (maxsets-1)) {
    			$('btn_next').style.visibility='hidden';
    			$('btn_prev').style.visibility='visible';
    		}
    		else {
    			$('btn_prev').style.visibility='visible';
    			$('btn_next').style.visibility='visible';
    		}
    	}
    	
    //alert('len:'+len+' offset:'+offset+' maxsets:'+maxsets+' step:'+step+' st:'+st);
    }
    please help me as fast as you can!!thanks!!
    Last edited by tpravioti; 01-15-2010 at 09:34 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •