admin管理员组文章数量:1419656
I am having a little trouble binding the theme customizer live preview javascript to an HTML <img src>
- more specifically it is my logo.
Here how the html looks on the page(which is fine and dandy):
<a class="footerlogo" href="#top"><img src="<?php echo mytheme_theme_mod( 'footer_logo' ); ?>" /></a> </div>
Now my problematic part is the JS - Here are my first two attempts. Both not working.
Attempt 1:
/** Footer logo */
wp.customize( 'mytheme_footer_logo', function( value ) {
value.bind( function( to ) {
$( '.footerlogo img src' ).html( to );
} );
} );
Attempt 2:
/** Footer logo */
wp.customize( 'mytheme_footer_logo', function( value ) {
value.bind( function( to ) {
var footer = $( '.footerlogo img' );
footer.attr( 'href', to );
} );
} );
Can anyone give me assistance on this?
I am having a little trouble binding the theme customizer live preview javascript to an HTML <img src>
- more specifically it is my logo.
Here how the html looks on the page(which is fine and dandy):
<a class="footerlogo" href="#top"><img src="<?php echo mytheme_theme_mod( 'footer_logo' ); ?>" /></a> </div>
Now my problematic part is the JS - Here are my first two attempts. Both not working.
Attempt 1:
/** Footer logo */
wp.customize( 'mytheme_footer_logo', function( value ) {
value.bind( function( to ) {
$( '.footerlogo img src' ).html( to );
} );
} );
Attempt 2:
/** Footer logo */
wp.customize( 'mytheme_footer_logo', function( value ) {
value.bind( function( to ) {
var footer = $( '.footerlogo img' );
footer.attr( 'href', to );
} );
} );
Can anyone give me assistance on this?
Share Improve this question edited Nov 11, 2013 at 19:27 user1632018 asked Nov 11, 2013 at 19:00 user1632018user1632018 4843 gold badges10 silver badges26 bronze badges1 Answer
Reset to default 0Oops, it seems that I accidentaly used the wrong tag, I used href instead of src. Simple fix:
/** Footer logo */
wp.customize( 'mytheme_footer_logo', function( value ) {
value.bind( function( to ) {
var footer = $( '.footerlogo img' );
footer.attr( 'src', to );
} );
} );
本文标签: Theme customizer live preview JS Trying to bind to an html image url without luck
版权声明:本文标题:Theme customizer live preview JS- Trying to bind to an html image url without luck 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745310053a2652885.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论