Category Archives: assetic

Symfony2: simple JavaScript routing with Assetic and HTML5 data Attributes

Simple example HTML5 code: <div id=”gallery” data-rollover_on=”{{ asset(‘bundles/testprojecttestbundle/images/play_button_on.png’) }}” data-rollover_off=”{{ asset(‘bundles/testprojecttestbundle/images/play_button_off.png’) }}”> …</div> JavaScript (JQuery): var rollover_play_off = mainjQuery(‘div[id=”gallery”]’).attr(‘data-rollover_off’); var rollover_play_on = mainjQuery(‘div[id=”gallery”]’).attr(‘data-rollover_on’); var original_image = ‘url(‘+rollover_play_off+’)’; var second_image = ‘url(‘+rollover_play_on+’)’;

Posted in assetic, Symfony2 | Leave a comment