简体   繁体   中英

How to change a jquery snippet to output a second element?

I am using the following code to show a "follow me" box to the left of my site.

I'd like to create a second button, right underneath this button that sent people who clicked it to an RSS link.

How could I do this?

Thanks!, Azeem

<!-- by Twitter Follow Me Box v1.1 -->
    <script type=\"text/javascript\">
        //<![CDATA[
        jQuery(document).ready(function(){
            jQuery(\"body\").append(\"<div id=\\\"tfmBox\\\"></div>\");
            jQuery(\"#tfmBox\").css({'position' : 'fixed', 'top' : '$top', 'width' : '30px', 'height' : '119px', 'z-index' : '1000', 'cursor' : 'pointer', 'background' : '#$color url(" . WP_PLUGIN_URL . "/twitter-follow-me-box/follow-me.png) no-repeat scroll $imagem_side top', '$side' : '0'});
            jQuery(\"#tfmBox\").click(function () { 
              window.open('http://twitter.com/$twitter_account/');
            });
        });
        //]]>
    </script>
    <!-- /by Twitter Follow Me Box -->

The very same way, you just have to change the URL adress to your RSS channel. Of course, you have to set 'top' CSS-property with different PHP variable. I'm not sure how $top looks like, but I guess it's with 'px' at the end:

$rssButtTop = substr($top,-3) + 119 + 5; //span is 5

This has to be in the PHP section of code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM