jquery - Anchor a button in a certain position -


i have img inside div, idea div functions button in fixed location needs remain in same area onresize event, have following on jquery:

$(window).resize(function () {         $("#btnbanner").css("top", $(window).height() / 2 - ($("#btnbanner").height() / 2) + 350);         $("#btnbanner").css("left", $(window).width() / 2 - ($("#btnbanner").width() / 2)); }); 

the code in put button in middle of page, half of button aligned middle of window.

now 350 test did position button below part of image.

this html:

<div id="contentbanner" class="bannerpresentation">     <img id="btnbanner" class="btnbannerinitial" src="~/content/assests/img/btnbannerinitial.png"/> </div> 

this css:

.bannerpresentation {     position: absolute;      z-index:10000;     background-color:white;     width:100%;     height:100%;     border-style: solid;      border-width: 1px;      background-image:url(assests/img/home/image.jpg);     background-repeat:no-repeat;     background-position:center center;     background-attachment:fixed;     -o-background-size: 100% 100%, auto;     -moz-background-size: 100% 100%, auto;     -webkit-background-size: 100% 100%, auto;     background-size: 100% 100%, auto; }  .btnbannerinitial {     position:relative;     cursor:pointer; } 

basically idea take out 350 , make variable resize, when resize keeps in same position, dont know if can achieved, dont know if there type of solution.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -