Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • akerman Friend
    #158183

    Hi,

    there’s a Javascript controlling the “Show/Hide Description” button on Job listings.

    I just want to switch the default behaviour so that it “starts” as “Show Descriptions” and thereby hide descriptions, instead of as now; showing them automatically.

    Javascript in Joblisting template:

    <script type="text/javascript">

    function hideDescription(){

    $$('.ja-job-description').setStyle('display', 'none');

    $E('#ja-control-description .hide').setStyle('display', 'none');

    $E('#ja-control-description .show').setStyle('display', '');

    }

    function showDescription(obj){

    $$('.ja-job-description').setStyle('display', 'block');

    $E('#ja-control-description .hide').setStyle('display', '');

    $E('#ja-control-description .show').setStyle('display', 'none');

    }

    </script>

    ..and the presentation part in same template:

    <?php } if( $jbconfig['posts']->get('posts_show_description', 1) ){ ?>

    <div id="ja-control-description">

    <a class="button hide" href="javascript:hideDescription()">

    <span style="vertical-align: top ! important;"><?php echo JText::_('Hide Job Descriptions')?></span>

    </a>

    <a class="button show" href="javascript:showDescription()" style="display: none">

    <span style="vertical-align: top ! important;"><?php echo JText::_('Show Job Descriptions')?></span>

    </a>

    </div>

    Any ideas are welcome

    Regards
    Akerman

    Vinh CV Friend
    #369781

    Dear akerman,

    You can simply implement this function:

    window.addEvent(‘domready’, function() {
    hideDescription();
    });

    akerman Friend
    #369853

    SOLVED! Thank you so much! :laugh:

    Including complete solution here. File = theme files like “../summary/jalist-item.php”:


    <script type="text/javascript">

    function hideDescription(){

    $$('.ja-job-description').setStyle('display', 'none');

    $E('#ja-control-description .hide').setStyle('display', 'none');

    $E('#ja-control-description .show').setStyle('display', '');

    }

    function showDescription(obj){

    $$('.ja-job-description').setStyle('display', 'block');

    $E('#ja-control-description .hide').setStyle('display', '');

    $E('#ja-control-description .show').setStyle('display', 'none');

    }

    window.addEvent('domready', function() {
    hideDescription();
    });

    </script>

    Although, there is a drawback/oddity: As soon as I select some sorting action in the box to the right,
    the Description shows anyway… i.e. the javascript alters state. There must be a way of making these to choices (showing vs. sorting) independent from each other.

    Regards
    Akerman

Viewing 3 posts - 1 through 3 (of 3 total)

This topic contains 3 replies, has 2 voices, and was last updated by  akerman 13 years, 10 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum