Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linking a php file to a HTML file?

On this site http://www.flatness.eu/test.html I have a link to a php file.

That file contains an art piece which is written in php.

The page contains layers of images which the user clicks to remove one by one until the page is empty.

Is it possible to make the last click on the php file link the user straight back to the html home page they started from?

like image 885
angela Avatar asked Jun 12 '13 12:06

angela


1 Answers

The php file you link to is using jQuery to add a class called houdini to images that are hidden. You can change the click handler to count the amount of images left where the class isn't houdini, and then redirect the user.

$(function() {                       //run when the DOM is ready
    $(".image").click(function() {     //use a class, since your ID gets mangled
      $(this).addClass("houdini");     //add the class to the clicked element

      if( $('.image:not(.houdini)').length == 1 )
      {
          // this is the last image, redirect user
          window.location = 'http://yourpageurl.com';
      }
    });
  });
like image 98
Ryan Avatar answered Sep 22 '22 01:09

Ryan