This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Developer » Help with load html
expandshrink

Help with load html

Help with load html

Friday 25 July 2014 3:53:19 pm - 1 reply

regards
I need help with load html file using jquery.
The idea is to load the content of a html file into a div in a tpl template full view.
But the content does not load when you click.
this is the code I use:

 <script type="text/javascript">
    {literal}
$(document).ready(function() {
  $('#letter-a a').click(function() {
    $('#diccionario').hide().load('a.html', function() {
      $(this).fadeIn();
    });
    return false;
  });
});
    {/literal}
</script>

This is the div:

 <div class="letter" id="letter-a">
          <h3><a href="#">A</a></h3>
        </div>

if any, other method please a code sample.

Friday 25 July 2014 4:49:18 pm

Hi Edixon,

you should try using .fadeOut instead of .hide since both use different css-attributes to let an element disapear.

On the other hand you should not chain those commands together since they will be executed immediately.
When fadeOut and fadeIn are called together, they will cause a flicker.

$(document).ready(function(){
    $('#letter-a').find('a').click(function(event){
        var dict = $('#dictionary');
        dict.fadeOut(400, function(){
            dict.load('a.html', function(){
                dict.fadeIn();
            })
        });
        return false;
    })
});

This should work, had not time testing yet.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from