• I am successfully using the [Plugin: pb-embedFlash] from within a post to load a html page containing a slideshow, using the shadowbox feature. I would like to automatically load an html page also containing a slideshow from a wordpress page link.

    Is this possible and if so how? Can i activate it via javascript by editing the html of the page using the wordpress “write page” function.

    Many thanks

    Martin

Viewing 15 replies - 16 through 30 (of 32 total)
  • Thread Starter martinbennett

    (@martinbennett)

    i added the shadowbox javascript to the header.php as you suggested.

    do i add the function to load something:
    openShadowbox(‘https://www.martinbennett.com/uploads/portfolio/index.html’, ‘html’, ‘Martin Bennett – Photographer’);

    also in the header.php or do i place it elsewhere?

    I tried it after the first code but nothing happened…

    You need to call that option “onload”, means after the page has finnished loading.

    So I suggest to try the second code snippet from my prior post:

    function callOpenShadowbox() {
      openShadowbox('https://www.martinbennett.com/uploads/portfolio/index.html', 'html', 'Martin Bennett - Photographer');
    }
    
    if(window.onload) {
      var temp = window.onload;
      window.onload=function(e) {
        temp(e);
        callOpenShadowbox();
      };
    }
    else{
      window.onload=function(e) {
        callOpenShadowbox();
      };
    }
    Thread Starter martinbennett

    (@martinbennett)

    ok but where do i place the second code?

    I could now test the thing and there is basically one change: It’s type: 'iframe' instead of player: 'html'.

    Anyways, I simplified the code a bit:

    <script type="text/javascript">
    	var openShadowbox = function(){Shadowbox.open({
    	        content:    'https://www.martinbennett.com/uploads/portfolio/index.html',
    	        type:     	'iframe',
    	        title:      'Martin Bennett - Photographer'
    	    })};
    	if(window.onload) {
    	  var temp = window.onload;
    	  window.onload=function(e) {
    	    temp(e);
    	    openShadowbox();
    	  };
    	}
    	else{
    	  window.onload=function(e) {
    	    openShadowbox();
    	  };
    	}
    </script>

    Just copy the bunch anywhere after calling wp_head();.

    Worked fine for me.

    Thread Starter martinbennett

    (@martinbennett)

    thank you that works a treat!

    Martin

    Thread Starter martinbennett

    (@martinbennett)

    just noticed a problem in safari and firefox the autoloader works but if i close the shadowbox layer and click on another page link it loads the layer again.

    I need it to only autoload on the first page: you can see it in action here

    https://test.martinbennett.com

    if you click on contact or Biography (which are pages) the shadowbox layer loads on top.

    Of course you should paste the code only on pages where it should be. Currently, the script is loaded on each page/post.

    You could check via php if it’s is_home() or something like that.

    Loading the Layer only once a session would also be possible, but is beyond my plugin and requires some programming skills.

    Thread Starter martinbennett

    (@martinbennett)

    is it possible to have the autoload on the first / home page of the domain but not on the other pages or posts?

    <?php if (is_home()) { ?>
    <script type="text/javascript">
    var openShadowbox = function(){Shadowbox.open({
            content:'https://www.martinbennett.com/uploads/portfolio/index.html',
            type:	'iframe',
            title:	'Martin Bennett - Photographer'
        })};
    if(window.onload) {
      var temp = window.onload;
      window.onload=function(e) {
        temp(e);
        openShadowbox();
      };
    }
    else{
      window.onload=function(e) {
        openShadowbox();
      };
    }
    </script>
    <?php } ?>

    This should automatically load the shadowbox only on your index/home page, not on pages or posts. A simple PHP condition. ??

    Hi,
    good guide

    but when ii try to use it in my site, it not works.
    I have a flash site.

    HTML

    <script type="text/javascript">
    
    var openShadowbox = function(content, player, title){
        Shadowbox.open({
            content:    content,
            player:     player,
            title:      title
        });
    };
    
    </script>
    <script type="text/javascript">
    	var openShadowbox = function(){Shadowbox.open({
    	        content:    'https://www.kickersjunior.it/pe-09/girl.html',
    	        type:     	'iframe',
    	        title:      'Girl'
    	    })};
    	if(window.onload) {
    	  var temp = window.onload;
    	  window.onload=function(e) {
    	    temp(e);
    	    openShadowbox();
    	  };
    	}
    	else{
    	  window.onload=function(e) {
    	    openShadowbox();
    	  };
    	}
    </script>

    FLASH

    on (release) {
    	getURL("javascript:openShadowbox('https://www.kickersjunior.it/pe-09/girl.html', 'iframe', 'Girl'););");
    }

    thank you

    Hmm you’re messing lots of things up.

    First of all, you define a function twice (openShadowbox). In the snippet I wrote for for martinbennett, openShadowbox was just a placeholder to call Shadowbox.open [no need to write the whole part twice so I put it into a variable].

    Then, you keep the onload functions, but you don’t need them – via flash, you can open the Shadowbox “whenever you want” easily.

    So I suggest you delete all the HTML/JavaScript you’ve posted above and call

    Shadowbox.open({content:'https://www.kickersjunior.it/pe-09/girl.htm',type:'iframe',title:'Girl'})

    directly in getURL().

    no, the error is here:

    'Girl'););");

    i wrote ); two times
    now works!

    but now i have another problem: can i set page size?
    In html is:

    rel="shadowbox;width=200;height=200"

    in flash?

    ...

    Thank You

    Well, I guess your code will work as I posted, as of you’re giving parameters to openShadowbox(), but tht function does not accept parameters and just does what it should: call Shadowbox.open() with the predefined values.

    To the rel attribute problem: I don’t know flash that good, sorry.

    Here, an user says to another user:

    just added some extra parameters for customization, when using shadowbox for “media”.

    function abrirSB(type, title, url, width, height)
    {
    Shadowbox.init({skipSetup: true});
    Shadowbox.open({type: type, title: title, content: url, width: width, height: height});
    };

    and into flash file:

    getURL(“javascript:abrirSB(‘img’, ‘Title’, ‘image.jpg’, ” ,”);”, “_self”);

    First value ‘img’ can be: “swf”, “flv”, “qt” (QuickTime), “wmp” (Windows Media Player), “iframe”, or “html”. For custom sized iframe, it will look something like this:

    getURL(“javascript:abrirSB(‘iframe’, ‘Title’, ‘image.jpg’, ‘450’ ,’450′);”, “_self”);

    that’s all!

    so i wrote in html:

    <script type="text/javascript">
    
    var openShadowbox = function(content, player, title){
        Shadowbox.open({
            content:    content,
            player:     player,
            title:      title,
    		width: 		width,
    		height: 	height
        });
    };
    
    </script>

    and in flash file, i wrote:

    on (release) {
    	getURL("javascript:openShadowbox('https://www.kickersjunior.it/retailer/richiesta.php', 'iframe', 'Ricerca Punti Vendita', '200', '200');");
    }

    but doesn’t work ??

    in code i forgot width & height

    var openShadowbox = function(content, player, title){

    var openShadowbox = function(content, player, title, width, height){

    FOR ALL USER: NOW MY CODE WORKS (my shadowbox loads html files and load it in my own size)

    thank you

Viewing 15 replies - 16 through 30 (of 32 total)
  • The topic ‘[Plugin: pb-embedFlash] Automatically open on page load’ is closed to new replies.