I have a website that uses the following script:
//==================== EXPAND ========================//
$('a.expand').live('click',function() {
var _hide = $(this).attr('data-hide');
$(this).addClass('activeSpan');
$(this).parent().find('.details-post').slideDown();
$(this).parents('li').find('.grid-reply').slideDown();
$(this).parents('li').find('.spanReply').slideDown();
$(this).parent().find('.textEx').html(_hide);
$(this).removeClass('expand');
if( $(this).hasClass( 'reply' ) )
{
$(this).parent().find('#reply_post').focus();
}
});
$('a.activeSpan').live('click',function() {
var _expand = $(this).attr('data-expand');
$(this).addClass('expand');
$(this).parent().find('.details-post').slideUp();
$(this).parents('li').find('.grid-reply').slideUp();
$(this).parents('li').find('.spanReply').slideUp();
$(this).parent().find('.textEx').html(_expand);
$(this).removeClass('activeSpan');
});
$('.optionsUser > li:last').css({'border':'none'});
This is used to display data when the user clicks on "expand". Instead of this, I want the text to appear automatically. How should I change the script? I have tried changing live('click' to live('load' but this doesn't work.
The site uses: https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
Thanks in advance.
This is the php code:
<!-- EXPAND -->
<a data-expand="<?php echo $_SESSION['LANG']['expand']; ?>" data-hide="<?php echo $_SESSION['LANG']['hide']; ?>" class="expand getData" data="<?php echo $key['id']; ?>" data-token="<?php echo $key['token_id']; ?>">
<?php echo $icon; ?>
<span class="textEx"><?php echo $_SESSION['LANG']['expand']; ?></span> <?php echo $typeMedia; ?>
</a>
And this is the sample html:
<a data-expand="Expand" data-hide="Collapse" class="expand getData" data="697" data-token="0f1966ac9d8529055f9b0e09c0a58a65cdf5d5e8"> <span class="textEx">Genişlet</span> </a>
Think of facebook or twitter, you click on expand and you get an area to reply to a post. At the moment I have to click to see the reply form, but I want that to appear by default.