Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Transfom an anonymous jQuery function to a nammed function

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #27364
    arkader
    Participant

    Hi everyone !!

    I’m making a new website full Ajax with jQuery
    The main page is composed by 9 squares, each square represents a section
    when i click on square, a new page is loaded into within the 9 squares

    However, i would like to create a function like

    Code:
    function DivToLoad (par1,par2,par3){

    }

    As i use jQuery, i use anonymous function and i must repeat the code for every square (wich is very heavy)

    here is the code i would like to transform

    Code:
    var square2 = $(‘#square2’) //the div to click

    $(square2).fadeOut(500,function(){

    $(this).css(‘background’,’none’)

    .load(‘pageToLoad1.html #divToLoad_A_2’, function(){ // I load an external div in this square

    $(square2).fadeIn(‘1000’);

    }); return false;

    });

    If a had i nammed function
    i would only write

    Code:
    DivToLoad(par1,par2,par3)

    Thanks Everyone !
    I would be very Gratefull !

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.