jquery wordpress template path -
need little bit of jquery. im bit of noob jquery wise.
i got template_dir in var:
$('#someid').click(function() { var templatedir = '<?php bloginfo("template_directory") ?>'; if(autostart) { $(this).html('<img src=" 'templatedir here' /images/pauze-play.png" />'); } else { $(this).html('<img src=" 'templatedir here' /images/pauze-play.png" />'); } autostart = !autostart; $('#mainslider.royalslider').royalslider('toggleautoplay'); });
i did stackoverflow searches , tried figure out ain't working due lacking skills, though feel rather simple.
thought this:
<img src=" 'templatedir +' /images/pauze-play.png" />'
but no...
thanks in advance
/paul
the code danyo poste work fine, on route chose defining templatedir javascript variable have :
$(this).html('<img src="' + templatedir + '/images/pauze-play.png" />');
notice: there no spaces between "' , '/ . might have been went wrong.
also might want declare templatedir global variable instead. have:
var templatedir = '<?php bloginfo("template_directory"); ?>'; jquery('.selector').click(function(){ ...
Comments
Post a Comment