SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Threaded View

  1. #1
    SitePoint Enthusiast
    Join Date
    May 2005
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can I turn this into a switch statement? (SOLVED)

    I'm trying to figure out if it would make more sense to turn the following code into a switch statement. How would I write it?

    Code:
    $('#loading').hide(); 
    
    	$('#sub-web-design').click(function(){
    		$('#loading').show(); 
    		$('#dynamic').load('/what-we-do/web-design', function() {
    		$('#loading').hide(); 
    		$(this).fadeIn('slow');
    		});
    		return false;
    	});
    
    	$('#sub-graphic-design').click(function(){
    		$('#loading').show(); 
    		$('#dynamic').load('/what-we-do/graphic-design', function() {
    		$('#loading').hide(); 
    		$(this).fadeIn('slow');
    		});
    		return false;
    	});
    
    	$('#sub-branding').click(function(){
    		$('#loading').show(); 
    		$('#dynamic').load('/what-we-do/branding', function() {
    		$('#loading').hide(); 
    		$(this).fadeIn('slow');
    		});
    		return false;
    	});
    
    	$('#sub-content-management').click(function(){
    		$('#loading').show(); 
    		$('#dynamic').load('/what-we-do/content-management', function() {
    		$('#loading').hide(); 
    		$(this).fadeIn('slow');
    		});
    		return false;
    	});
    	$('#sub-seo').click(function(){
    		$('#loading').show(); 
    		$('#dynamic').load('/what-we-do/seo', function() {
    		$('#loading').hide(); 
    		$(this).fadeIn('slow');
    		});
    		return false;
    	});
    I appreciate your help!
    Last edited by climberusa; Jul 2, 2007 at 11:07.


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
  •