Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: Lightbox 2.04 and another script(s)

  1. #1
    Join Date
    Nov 2010
    Posts
    16
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Lightbox 2.04 and another script(s)

    Hello,

    I've 3 scripts working on a page:
    One change the image background with an onload parameter
    <body onLoad="randomBg();" "startLightbox()">
    (I've tried changin this various time, deleting quotes, changing the location of the properties or deleting one of them.)

    One "animate" a menu;

    Another make a view of images into gallery with Lightbox.

    The last one it doesn't work. I've tried checking the parameters than other users have displayed on this forum, but at now without results.
    if other informations of code are required, please contact me!
    The lighbox version is 2.04.

    Thanks in advance,

    Fabio
    Last edited by jscheuer1; 11-11-2010 at 12:12 AM. Reason: Post moved to a new thread

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Lightbox v2.04 requires nothing in the body onload, so (assuming the random background script does) use:

    Code:
    <body onLoad="randomBg();">
    You've shown us nothing about the animated menu script and very little about the random background script. I know about Lightbox though, as long as 2.04 is the version, I know it very well.

    In any case, if you want more help:

    Please post a link to a page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    thephotographer (11-11-2010)

  4. #3
    Join Date
    Nov 2010
    Posts
    16
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    I work locally, that's why I don't have posted links.
    I prefer work locally and, when the website will be finished, I will upload it to my hosting.
    But, no problem - when I return at home after work (in 2 hours), I will post scripts and every info I can gave.

    Thank you so much, and sorry for the mistaken caused by my poor English language knowledge.
    Hope you understand what I mean, I will do my best for traslate as well as possible.

    Regards,

    Fabio
    Last edited by thephotographer; 11-11-2010 at 04:16 PM.

  5. #4
    Join Date
    Nov 2010
    Posts
    16
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    first script: Background change at every refresh / access
    html:
    <body onLoad="randomBg();">

    script:
    <script type="text/javascript">
    function randomize(min, max) {
    if (!min)
    min = 0;
    if (!max)
    max = 1;
    return Math.floor(Math.random()*(max+1)+min);
    }
    function randomBg() {
    var bgs = new Array();
    bgs.push("backgrounds/01.jpg");
    bgs.push("backgrounds/02.jpg");
    bgs.push("backgrounds/03.jpg");
    bgs.push("backgrounds/04.jpg");
    bgs.push("backgrounds/05.jpg");
    bgs.push("backgrounds/06.jpg");
    bgs.push("backgrounds/07.jpg");
    bgs.push("backgrounds/08.jpg");
    bgs.push("backgrounds/09.jpg");
    bgs.push("backgrounds/10.jpg");
    bgs.push("backgrounds/11.jpg");
    bgs.push("backgrounds/12.jpg");
    bgs.push("backgrounds/13.jpg");

    document.body.style.backgroundImage = "url(" + bgs[randomize(0, bgs.length-1)] + ")";
    }
    </script>

    Fully working.

    Second Script: Animated Menù

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="jquery.easing.1.3.js"></script>
    <script type="text/javascript">
    $(function() {
    /*
    * for each menu element, on mouseenter,
    * we enlarge the image, and show both sdt_active span and
    * sdt_wrap span. If the element has a sub menu (sdt_box),
    * then we slide it - if the element is the last one in the menu
    * we slide it to the left, otherwise to the right
    */
    $('#sdt_menu > li').bind('mouseenter',function(){
    var $elem = $(this);
    $elem.find('img')
    .stop(true)
    .animate({
    'width':'170px',
    'height':'170px',
    'left':'0px'
    },400,'easeOutBack')
    .andSelf()
    .find('.sdt_wrap')
    .stop(true)
    .animate({'top':'140px'},500,'easeOutBack')
    .andSelf()
    .find('.sdt_active')
    .stop(true)
    .animate({'height':'170px'},300,function(){
    var $sub_menu = $elem.find('.sdt_box');
    if($sub_menu.length){
    var left = '170px';
    if($elem.parent().children().length == $elem.index()+1)
    left = '-170px';
    $sub_menu.show().animate({'left':left},200);
    }
    });
    }).bind('mouseleave',function(){
    var $elem = $(this);
    var $sub_menu = $elem.find('.sdt_box');
    if($sub_menu.length)
    $sub_menu.hide().css('left','0px');

    $elem.find('.sdt_active')
    .stop(true)
    .animate({'height':'0px'},300)
    .andSelf().find('img')
    .stop(true)
    .animate({
    'width':'0px',
    'height':'0px',
    'left':'85px'},400)
    .andSelf()
    .find('.sdt_wrap')
    .stop(true)
    .animate({'top':'25px'},500);
    });
    });
    </script>

    Use CSS and its fully working.

    for insert the gallery I've used CSS and HTML, except for lightbox -then I used the information on this website:

    http://www.lokeshdhakar.com/projects/lightbox2/

    THis third part doesn't work.
    The gallery is visible and its fine, but the images will be loaded on a new page.
    I've searched for a solution on many website or forums but without results.
    Hope than the information provided will be useful.

    Fabio

  6. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Assuming that's how you have them installed, it could work. The first suggestion I would have though is to make sure you can get Lightbox 2.04 working on its own, on a page with no other script. It's a complicated script with numerous support files. Once you're sure you have that working, set up the page like so (I've changed the first line of the animated menu script and added a line in front of that, both of those lines highlighted):

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type="text/javascript">
    function randomize(min, max) {
    if (!min)
    min = 0;
    if (!max)
    max = 1;
    return Math.floor(Math.random()*(max+1)+min);
    }
    function randomBg() {
    var bgs = new Array();
    bgs.push("backgrounds/01.jpg");
    bgs.push("backgrounds/02.jpg");
    bgs.push("backgrounds/03.jpg");
    bgs.push("backgrounds/04.jpg");
    bgs.push("backgrounds/05.jpg");
    bgs.push("backgrounds/06.jpg");
    bgs.push("backgrounds/07.jpg");
    bgs.push("backgrounds/08.jpg");
    bgs.push("backgrounds/09.jpg");
    bgs.push("backgrounds/10.jpg");
    bgs.push("backgrounds/11.jpg");
    bgs.push("backgrounds/12.jpg");
    bgs.push("backgrounds/13.jpg");
    
    document.body.style.backgroundImage = "url(" + bgs[randomize(0, bgs.length-1)] + ")";
    }
    </script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="jquery.easing.1.3.js"></script>
    <script type="text/javascript">
    jQuery.noConflict();
    jQuery(function($) {
    /*
    * for each menu element, on mouseenter, 
    * we enlarge the image, and show both sdt_active span and 
    * sdt_wrap span. If the element has a sub menu (sdt_box),
    * then we slide it - if the element is the last one in the menu
    * we slide it to the left, otherwise to the right
    */
    $('#sdt_menu > li').bind('mouseenter',function(){
    var $elem = $(this);
    $elem.find('img')
    .stop(true)
    .animate({
    'width':'170px',
    'height':'170px',
    'left':'0px'
    },400,'easeOutBack')
    .andSelf()
    .find('.sdt_wrap')
    .stop(true)
    .animate({'top':'140px'},500,'easeOutBack')
    .andSelf()
    .find('.sdt_active')
    .stop(true)
    .animate({'height':'170px'},300,function(){
    var $sub_menu = $elem.find('.sdt_box');
    if($sub_menu.length){
    var left = '170px';
    if($elem.parent().children().length == $elem.index()+1)
    left = '-170px';
    $sub_menu.show().animate({'left':left},200);
    } 
    });
    }).bind('mouseleave',function(){
    var $elem = $(this);
    var $sub_menu = $elem.find('.sdt_box');
    if($sub_menu.length)
    $sub_menu.hide().css('left','0px');
    
    $elem.find('.sdt_active')
    .stop(true)
    .animate({'height':'0px'},300)
    .andSelf().find('img')
    .stop(true)
    .animate({
    'width':'0px',
    'height':'0px',
    'left':'85px'},400)
    .andSelf()
    .find('.sdt_wrap')
    .stop(true)
    .animate({'top':'25px'},500);
    });
    });
    </script>
    <script type="text/javascript" src="js/prototype.js"></script>
    <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
    <script type="text/javascript" src="js/lightbox.js"></script>
    <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
    </head>
    <body onload="randomBg();">
    
    </body>
    </html>
    The order of the scripts is important. Put any additional styles before the first script. Fill in the title tag as desired. Put whatever markup is required in the body.

    If you want more help, put up a live demo somewhere I can have a look at it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. The Following User Says Thank You to jscheuer1 For This Useful Post:

    thephotographer (11-12-2010)

  8. #6
    Join Date
    Nov 2010
    Posts
    16
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Really thanks for everything you provided, unfortunately I can try to modify it only on monday, cause I' will be out for a liveshow shooting.

    I've understand that the order is really important, cause I've changed location of the scripts in the file and, at every change, the website appear for example much slower or blocked, or faster.

    The next time I think I will provide to you the code entirely, uploading the website.

    At now I assume that's completed at 70 / 75 %, and its a good results for a newbie like me.

    Surely it will be better in a future, but I appreciate the actual result.
    I will feedback you soon about the results, and §I really hope it works

    really thank you.

    Fabio

  9. #7
    Join Date
    Nov 2010
    Posts
    16
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Hello,
    Actually I've tested lightbox and it works if its in a page by itself.

    I've uploaded a page of the website: here below you can find it:

    www.fabiomancin.com/xyz.html

    Hope you can help me,

    Thank you,

    Fabio

  10. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Your live demo has the lightbox scripts twice in the head. The first are in the wrong place. Go back to my previous post and follow the instructions given there.

    Also, all the lightbox scripts and stylesheet are all 404 not found. Install them on the live demo at least as well as on the local copy you have that is working.

    Looks like the scripts are in the root, not the js folder. I couldn't find the stylesheet.

    The prototype.js file appears to be out of date as well, use version 1.6.0.2 which comes with the lightbox 2.04 package.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  11. The Following User Says Thank You to jscheuer1 For This Useful Post:

    thephotographer (11-16-2010)

  12. #9
    Join Date
    Nov 2010
    Posts
    16
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    I've inserted all of the CSS properties in the style.css, for have a unique CSS stylesheet.
    I've leave the second script as well and update all of the code path.
    Of course, I've update the script, as you've tell.
    This solution have worked one time, with script loading, and now seems to doesn't work newly.

    Thank you for your precious support.

    Fabio

  13. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by thephotographer View Post
    This solution have worked one time, with script loading, and now seems to doesn't work newly.
    What does that mean? It works here. The images are way too large in both dimensions and byte size though. So subsequent lightbox activations appear to overtake the page. It looks as though a new page is loading.

    I think what you are getting at is that once the lightbox opens, subsequent lightboxes almost look like a fresh page. But it really is a lightbox. If you scroll down far enough to the right and bottom you will see the close button.

    Fix the dimensions on the images (resize and optimize them in an image editing program) and you won't have such a large lightbox.
    Last edited by jscheuer1; 11-16-2010 at 10:41 AM. Reason: English usage
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  14. The Following User Says Thank You to jscheuer1 For This Useful Post:

    thephotographer (11-23-2010)

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
  •