Announcement

Collapse
No announcement yet.

Javascript - How to insert Sellerdeck Variable?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Javascript - How to insert Sellerdeck Variable?

    Hello

    After many hours I am still stuck - pls can you help?

    How do I insert Sellerdeck Variable for an image into javascript within <body> so I can insert numerous images for each product?

    Pls see my website page here

    The fotorama-fancybox query is a slideshow and requires putting javascript into the <head> as well as the <body> tag - I would like to insert Variables into the <body> tag in the red place below.


    Javascript above <head>:

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <link href="fotorama.css" rel="stylesheet">
    <script src="js/fotorama.js"></script>
    <script>
    $(function() {
    $('#my-fotorama').fotorama();
    });
    </script>
    <script src="fancybox/jquery.fancybox-1.3.4.pack.js"></script>


    Javascript within <body>:
    <div id="fotorama"></div>

    <script>
    $(function () {
    var imgData = [
    {img: 'images/smallimage.jpg', href: 'images/bigimage00.jpg'}, // img - Fotorama src, href - Fancybox
    {img: 'i/04_spikydog.jpg', href: 'i/full/a04_spikydog.jpg', caption: 'Spikydog in fotorama', title: 'Spikydog in fancybox'}, // caption - Fotorama caption, title - Fancybox
    {href: 'i/full/a29_hills.jpg'} // When 'img' is missing, Fotorama take 'href'
    ];


    $.fn.noop = function(){return this};
    var fotorama = $('#fotorama');


    fotorama.fotorama({
    data: imgData,
    width: 380,
    height: 444,
    navPosition: 'left',
    vertical: 'active',
    thumbSize: 100,
    aspectRatio: 700/467,
    thumbsPreview: true,
    caption: 'overlay',
    click: true,
    onClick: function(data){
    var fotoramaClasses = fotorama.attr('class');
    var fotoramaTouchStyle = fotorama.data('options').touchStyle;
    // fancybox manual call
    $.fancybox(fotorama.data('options').data,
    {
    type: 'image',
    index: data.index,
    changeFade: 333,
    transitionIn: 'elastic',
    transitionOut: 'elastic',
    padding: 0,
    orig: $('.fotorama__wrap', fotorama),
    onStart: function(fancybox, i) {
    $.extend(fotorama.data('options'), {touchStyle: false});
    fotorama
    .trigger('showimg', [i, 333])
    .removeClass('fotorama_csstransitions')
    .find('.fotorama__wrap')
    .removeClass('fotorama__wrap_style_touch')
    .addClass('fotorama__wrap_style_fade')
    .find('.fotorama__frame').not('.fotorama__frame_active')
    [fotoramaTouchStyle ? 'fadeTo': 'noop'](0, 0);
    },
    onClosed: function() {
    $.extend(fotorama.data('options'), {touchStyle: fotoramaTouchStyle});
    fotorama
    .trigger('showimg', [undefined, 0])
    .attr({'class': fotoramaClasses})
    .find('.fotorama__wrap')
    [fotoramaTouchStyle ? 'addClass' : 'removeClass']('fotorama__wrap_style_touch')
    [!fotoramaTouchStyle ? 'addClass' : 'removeClass']('fotorama__wrap_style_fade')
    .find('.fotorama__frame')
    [fotoramaTouchStyle ? 'fadeTo': 'noop'](0, 1);
    }
    });

    // stop fotorama
    return false;
    }
    });
    });
    </script>

    Any help really appreciated!
    Thanks
    Catherine

    #2
    Have you tried:
    Code:
    {img: '<actinic:variable name="Small1" encoding="perl" selectable="false" />', href: '<actinic:variable name="Big1" encoding="perl" selectable="false" />'}
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Thank you Norman, you are amazing!

      This works, saves me hours having to do each product individually - really appreciated.

      Comment


        #4
        Hi Norman

        So sorry, on my screen it looked like the code was working but it doesn't.

        When I put your code in, automatically the Actinic Variable highlighed in blue, I wasn't sure if that was correct or if you were trying to manually write the code for a variable so it didn't actually link?

        Using this code even replacing 1 image:
        1 - The image disappears on the LHS thumbnail navigation
        2 - I cannot upload the website at all, I get error message saying some filenames conflict and must be renamed before the upload - although I've renamed them all and this still doesn't work.

        Any other ideas?

        Thanks
        Catherine

        Comment


          #5
          Actinic puts everything in the server into acatalog. It won't let you upload 2 files from different locations that have the same name. Double-check for that. Remember it's not just your fotorama files, if you've used the same filenames elsewhere in Actinic you'll get a conflict.

          As for the JavaScript errors, images not showing, etc: Preview and inspect the source code of the preview page to see what's being generated.

          Also consider using the more normal fotorama way of including your images as plain HTML instead of JavaScript structures.
          Code:
          <div class="fotorama" data-width="700" data-height="467">
            <a href="<actinic:variable name="Small1" selectable="false" />"><img src="<actinic:variable name="Big1" selectable="false" />"></a>
            <a href="<actinic:variable name="Small2" selectable="false" />"><img src="<actinic:variable name="Big2" selectable="false" />"></a>
            <a href="<actinic:variable name="Small3" selectable="false" />"><img src="<actinic:variable name="Big3" selectable="false" />"></a>
          </div>
          (I may have the Small and Big entries reversed as I don't know fotorama)

          I've done many such add-ons for Actinic and they are never trivial. Often several days solid work due to Actinic quirks, browser incompatibilities, etc. Often conditional code is needed to allow for Preview and live pages.
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment


            #6
            Ok thanks, realise this might take a little while to sort out.

            Appreciate the ideas, will go through and see what is best.

            Thanks again.
            Catherine

            Comment

            Working...
            X