Web Analytics Made Easy -
StatCounter Why wont this ad move? - CodingForum

Announcement

Collapse
No announcement yet.

Why wont this ad move?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why wont this ad move?

    Why wont this ad box move to where the css code tells it.
    Code:
    <div id="stickynote2" class="stickynote">
    "Sponsored Links"
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- fukkujuj -->
    <ins class="adsbygoogle"
         style="display:inline-block;width:728px;height:90px"
         data-ad-client="ca-pub-7327945792706541"
         data-ad-slot="5010452147"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    <center><a href="#" onClick="mysticky2.showhidenote('hide');return false">[Hide This Ad]</a></center>
    </div>
    Code:
    .stickynote{
    background-color: #ffffff;
    border:1px solid red;
    bottom:15px;
    color:#000000;
    font-family:Arial, Helvetica, sans-serif;
    font-size: 15px;
    height:128px;
    left: 0;
    margin: auto;
    padding: 5px 0px 0px 12px;
    position: absolute;
    right: 0;
    width:740px;
    }

    Javascript in case its needed

    /* Sticky Note Script v2.0
    * Created: Feb 7th, 2011 by DynamicDrive.com. This notice must stay intact for usage
    * Author: Dynamic Drive at Dynamic Drive DHTML(dynamic html) & JavaScript code library
    * Visit Dynamic Drive DHTML(dynamic html) & JavaScript code library for full source code
    */


    jQuery.noConflict()

    function stickynote(setting){
    var thisobj=this
    this.cssfixedsupport=!document.all || document.all && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //check for CSS fixed support
    this.reposevtstring='resize.' + setting.content.divid + (!this.cssfixedsupport? ' scroll.' + setting.content.divid : '')
    this.s=jQuery.extend({content:{divid:null, source:'inline'}, pos:['center', 'center'], hidebox:0, showfrequency:'always', fixed:true, fade:true}, setting)
    jQuery(function($){ //on document.ready
    if (setting.content.source=="inline")
    thisobj.init($, setting)
    else
    thisobj.loaddata($, setting)
    })
    }

    stickynote.prototype={

    positionnote:function($, x, y){
    var $note=this.$note
    var windowmeasure={w:$(window).width(), h:$(window).height(), left:$(document).scrollLeft(), top:$(document).scrollTop()} //get various window measurements
    var notedimensions={w:$note.outerWidth(), h:$note.outerHeight()}
    var xpos=(x=="center")? windowmeasure.w/2-notedimensions.w/2 : (x=="left")? 10 : (x=="right")? windowmeasure.w-notedimensions.w-25 : parseInt(x)
    var ypos=(y=="center")? windowmeasure.h/2-notedimensions.h/2 : (y=="top")? 10 : (y=="bottom")? windowmeasure.h-notedimensions.h-25 : parseInt(y)
    xpos=(this.cssfixedsupport && this.s.fixed)? xpos : xpos+windowmeasure.left
    ypos=(this.cssfixedsupport && this.s.fixed)? ypos : ypos+windowmeasure.top
    $note.css({left:xpos, top:ypos})
    },

    showhidenote:function(action, callback){
    var $=jQuery
    var thisobj=this
    if (action=="show"){
    this.$note.css('zIndex', stickynote.startingzindex++)
    this.positionnote($, this.s.pos[0], this.s.pos[1])
    if (this.s.fixed){
    $(window).bind(this.reposevtstring, function(){thisobj.positionnote(jQuery, thisobj.s.pos[0], thisobj.s.pos[1])})
    }
    this.$note.fadeIn(this.s.fade? 500 : 0, function(){
    thisobj.positionnote($, thisobj.s.pos[0], thisobj.s.pos[1])
    if (typeof callback=="function")
    callback()
    if (document.all && this.style && this.style.removeAttribute)
    this.style.removeAttribute('filter') //fix IE clearType problem
    })
    }
    else if (action=="hide"){
    this.$note.hide()
    if (this.s.fixed){
    $(window).unbind(this.reposevtstring)
    }
    }
    },

    loaddata:function($, setting){
    var thisobj=this
    var url=setting.content.source
    var ajaxfriendlyurl=url.replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+"/")
    $.ajax({
    url: ajaxfriendlyurl, //path to external content
    async: true,
    dataType: 'html',
    error:function(ajaxrequest, e){
    alert('Error fetching Ajax content.\nError Status: '+e.status+'\nServer Response: '+ajaxrequest.responseText)
    },
    success:function(content){
    $(document.body).append(content)
    thisobj.init($, setting)
    }
    })
    },

    init:function($, setting){
    var thisobj=this
    this.$note=$('#'+setting.content.divid)
    if (this.s.fixed && this.cssfixedsupport){
    this.$note.css({position:'fixed'})
    }
    this.$note.css({visibility:'visible', display:'none'})
    var showfrequency=this.s.showfrequency
    var randomnumber=Math.floor(Math.random()*showfrequency)
    if ((showfrequency=="session" && !stickynote.routines.getCookie(this.s.divid+"_persist")) || showfrequency=="always" || (!isNaN(randomnumber) && randomnumber==0)){
    if (showfrequency=="session")
    stickynote.routines.setCookie(this.s.divid+"_persist", 1)
    this.showhidenote("show", this.s.hidebox>0? function(){setTimeout(function(){thisobj.showhidenote("hide")}, thisobj.s.hidebox*1000)} : null)
    }
    }
    }

    stickynote.startingzindex=100

    stickynote.routines={

    getCookie:function(Name){
    var re=new RegExp(Name+"=[^;]*", "i"); //construct RE to search for target name/value pair
    return (document.cookie.match(re))? document.cookie.match(re)[0].split("=")[1] : null //return cookie value if found or null
    },

    setCookie:function(name, value, days){
    var expirestr=''
    if (typeof days!="undefined") //if set persistent cookie
    expirestr="; expires="+expireDate.setDate(new Date().getDate()+days).toGMTString()
    document.cookie = name+"="+value+"; path=/"+expirestr
    }
    }
    Thanks
    Last edited by canadacatman; Sep 11, 2016, 08:03 PM.

  • #2
    I dont know exactly what you are asking for?

    Where do you want it to show up relative to your page?

    It seems to work fine on the JSFiddle

    Let me know and we can move further.
    Riley
    Riley-Shannon.com - My Portfolio
    FraktalServices.com - My Company

    Comment

    Working...
    X