WordPress.org

Forums

WP Float
[resolved] Stationary positioning (12 posts)

  1. topcomedia
    Member
    Posted 2 years ago #

    Hi,

    Is there a possibility i could get the ad space to not float up and down the page when scrolling? so static?

    Im using this plugin to add more Advertising space on our site.

    Thanks

    http://wordpress.org/extend/plugins/wp-float/

  2. samhagin
    Member
    Plugin Author

    Posted 2 years ago #

    you can try using this code

    <script>
    jQuery(document).ready(function(){
    jQuery('#wp-float-post-19').css('position','absolute');
    });
    </script>

    please make sure you change wp-float-post-19 to the id for the wp float item. you can find the id by checking the HTML source.

    if you are unable to find it, you can reply with the link to the page with the item

  3. jigsme
    Member
    Posted 1 year ago #

    Hi Sam,
    I been trying all sorts with code you provide with the right id for the wp float item but I have no success, so I guess I haven't insert in the right place.
    I am using the float in the widgets so the id is: #wp-float-widget-3.
    So in which file should I insert the whole script:

    <script>
    jQuery(document).ready(function(){
    jQuery('#wp-float-widget-3').css('position','absolute');
    });
    </script>

    Sorry to bother you, but I been trying to find another plugin which could do that but I can't find any :-(
    Thanks you

    http://wordpress.org/extend/plugins/wp-float/

  4. samhagin
    Member
    Plugin Author

    Posted 1 year ago #

    what is the link to the page using wp float?

  5. koby360
    Member
    Posted 1 year ago #

    Hi, I have the same request. samhagin, where should I place the script you posted above? I am using the WP Float Content option, and have located the unique ID and entered it as you described. However it is still floating.

  6. samhagin
    Member
    Plugin Author

    Posted 1 year ago #

    you can create a text widget and add the code to it

  7. koby360
    Member
    Posted 1 year ago #

    My goodness, that works, thank you so much.

    In case anyone else is still struggling, I'll put it in my layman's terms:
    - create your WP Float content under settings/WP Float Options, Save
    - Create a text widget (not a WP Float Widget), I placed mine in the footer so it is present across the whole site
    - Copy samhagin's script above, paste,
    - View the html source of your page, find the unique value for the content, mine looked like this:

    <div id="12-wpf">
                    <span style="color: #ffffff;">Text is located here</span>                     </div>
    				<script type='text/javascript'>
                                    jQuery(document).ready(function($) {
                                            jQuery('#12-wpf').dcFloater({
                            width: '',
                            location: 'top',
                            align: 'right',
                            offsetLocation:40,
                            offsetAlign:100,
                            speedFloat:'',
                            tabText: '',
                            tabClose: false,
                            easing: 'easeOutQuint',
                            event: 'hover',
    			center: true, centerPx: 100,                        disableFloat:true,
                            *******idWrapper: '12-wpf-id',*******
    
                                            });
                                    });

    - The line with the asterix is the one you want, copy the value and paste that in in the text widget to replace '#wp-float-post-19'
    - So my script looks like this:

    <script>
    jQuery(document).ready(function(){
    jQuery('#12-wpf-id').css('position','absolute');
    });
    </script>
  8. samhagin
    Member
    Plugin Author

    Posted 1 year ago #

    I am glad it worked out for you

  9. koby360
    Member
    Posted 1 year ago #

    Thanks again samhagin. So there is one issue that I discovered - the Float content has a different div id on each page. So what I've found is I can get it to work on one page, or I need to do a script for every page (not ideal).

    Is there a variation on the jquery script that includes a wildcard, that way it works for any page?

  10. samhagin
    Member
    Plugin Author

    Posted 1 year ago #

    You can try this

    <script>
    jQuery(document).ready(function(){
    jQuery('[id*=wpf]').css('position','absolute');
    });
    </script>

    this will select all wp float items (added via shortcode ) since their ids have "wpf" in them

  11. koby360
    Member
    Posted 1 year ago #

    WIN! That solved it perfectly. Great job!

  12. PlainFlesh
    Member
    Posted 1 year ago #

    Is it possible to use a variation on this code to adjust the z-index of the floating icon?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic