Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3234338
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:22:47+00:00 2026-05-17T17:22:47+00:00

Before you start reading… You should know that there are many questions below… I

  • 0

Before you start reading… You should know that there are many questions below… I will appreciate any help to understand any part of the MIT code(jFlip plugin for jQuery v0.4) which I find very hard to understand

You can find the code if you like at http://plugins.jquery.com/project/jFlip

And see it working at http://www.jquery.info/scripts/jFlip/demo.html

< script type=”text/javascript>

(function($){    
       $(function(){    
           $("#g1").jFlip(800,800,{background:"green",cornersTop:false}).
           bind("flip.jflip",function(event,index,total){
              $("#l1").html("Image "+(index+1)+" of "+total);
           });        
       });
   })(jQuery);

< /script>

  1. the function gets a $ and than uses the $ before another function?! and than it looks like it becomes a function $(“g1”) … it feels like a delegate (is it? how does it work)
  2. How does the bind work…it’s a js function right? (I mean part of the language)
  3. what is the “g1” role? I would expect something like “select case” somewhere in the code, but can’t find one…

Another peace of code that I find hard is:

; (function($) {
      var Flip = function(canvas, width, height, images, opts) {
      //private vars
      opts = $.extend({ background: "green", cornersTop: true, scale: "noresize" }, opts);
      var obj = this,
      el = canvas.prev(),
  1. why is the “;” needed before he function
  2. there is a var within a var – what does it mean- it’s a class, struct or what?
  3. el = canvas.prev() … el is not defined anywhere is it a saved word for something?

and last is the one that is important for me:

.click(function(){
  if(onCorner && !flipping) {
      el.trigger("flip.jflip",[index,images.length]);
  }
  return false;
})
  1. what is the dot syntax : .click(… some function definition…)
  2. I need to make the code in the click to execute every 5 seconds …like onPageLoad(while(true) set timeout=5000; call click;)

That’s a good time to thank Trufa for the those links:
How to get the bookflip effect with JavaScript

Thank you so much for your time
Asaf

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T17:22:48+00:00Added an answer on May 17, 2026 at 5:22 pm

    1 Question

    Here you are having anonymous function that auto executes (function(){})(); and in it you are passing jQuery object (which is actually a function) as variable that’s called $. This is the same (calling it LALA and not $):

    (function(LALA){    
           LALA(function(){    
               LALA("#g1").jFlip(800,800,{background:"green",cornersTop:false}).
               bind("flip.jflip",function(event,index,total){
                  LALA("#l1").html("Image "+(index+1)+" of "+total);
               });        
           });
       })(jQuery);
    

    Bind is implemented in jQuery object as separate sub function (method). There is more complicated code going on in it that handles events in different browsers, but makes sure that your event gets bind no meter what you use to view the page.

    This #g1 is CSS style selector. You will have to google on that for more info. It means “get the HTML element which has ID=’g1′ and call the following method on it”. In you case you are selecting element with ID=g1 and calling jFlip() on it. To select elements which all have class ELEMENT, you would use dot like so $(".ELEMENT").

    2 Question

    Semicolon is needed only if you write two or more statements in same row like this:

    alert("lalala") var a = 2+3
    

    So you must write them in separate rows, like so:

    alert("lalala") 
    var a = 2+3
    

    Or separate with ; in the same row:

    alert("lalala"); var a = 2+3
    

    For vars you will have to know that there are no types in JS. You can have function in var, integer, string… and objects. Objects are made of functions using keyword new. There in your code you are saving reference Flip to anonymous function that does something… To declare variables var is not needed, so you can have el = 10 and that stands as a valid variable definition.

    3 Question

    Dot syntax doesnt exist. You are calling .click() on jQuery object that was before the . in a line before.

    For timeout you will have to have some more XP… google some more…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Before I start, I know there is this post and it doesn't answer my
Before I start with the real question, let me just say that I might
Recently thanks to rails' popularity, many people start using activerecord as model. however, before
Before you start firing at me, I'm NOT looking to do this, but someone
Before I start developing a desktop application, I was wondering how large the installer
Lots of people talk about writing tests for their code before they start writing
I'm trying to be a good developer and create some documentation before I start
I want to start looking at WCF but to be honest before I do
I have to solve a following problem. there are many files let's say 3
I'm trying to build a Chrome browser extension, that should enhance the way the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.