open my lightbox on pageload - lightbox

If you visit my page (http://www.dentalfixrx.com/local-equipment-repair/) and click the "get started" button at the top right you will open a lightbox form.
I would like to create code so the lightbox appears on page load automatically.
Here is the code to open the lightbox currently: <img src="images/mobile-dental-repairs.gif" width="184" height="36"border="0" class="getstarted" />
simply visiting http://www.dentalfixrx.com/local-equipment-repair/download-kit.html does not work

Wrap the lightbox code into a parent div (.parent) and hide that whole div initially
HTML:
<div class="parent">
<div class="downloadkit"><form action="formmail.php" method="post" >
<input type="hidden" name="recipients" value="brian#dentalfixrx.com,billdonatojr#gmail.com,andy#dentalfixrx.com" />
<input type="hidden" name="subject"value="New DentalFixRx Lead!" />
<input type="hidden" name="good_url" value="thanks-downloadkit.php" />
<div style=" width:300px; position:absolute; right:10px; top:15px;">
<h1 style="font-size:20px; margin:5px auto;">Emergency Fix Needed?</h1>
To receive a fast response, please complete the form below and click the "submit" button.
</div>
<p><label>Name/Business:<span class="red">*</span></label><input type="text" name="name" id="name" /></p>
<p> <label> Phone:<span class="red">*</span></label> <input type="text" name="phone" id="phone" / > </p>
<p> <label>Email:<span class="red">*</span></label> <input type="text" name="email" id="email" / ></p>
<p> <label>State:</label> <input type="text" name="st" id="st" / ></p>
<p> <label>Zip Code:</label> <input type="text" name="zip" id="zip" / ></p>
<p> <label>Service Needed:</label><select name="">
<option>Select one</option>
<option>Handpiece Repair</option>
<option> -Low Speed</option>
<option> -High Speed</option>
<option> -Electric High Speed</option>
<option>Equipment Repair</option>
<option> -Autoclaves</option>
<option> -Chairs & Delivery Units</option>
<option> -Compressors</option>
<option> -Vacuum Pumps</option>
<option> -Ultrasonic Scalers</option>
<option> -Instrument Sharpening</option>
<option> -Upholstery</option>
<option> -Curing Lights</option>
<option> -Film Processors</option>
<option>Other Service</option>
</select></p>
<p> <label>Select type of request:</label><select name="">
<option>Select one</option>
<option>Just a casual question</option>
<option>I need some help but it's not super time-sensitive</option>
<option>Things are broken and I'd like them not to be!</option>
<option>I can't get things done, please reply ASAP</option>
</select></p>
<div class="clear"></div>
<input value=" " type="submit" class="download-btn" width="231px" height="36px" />
<span>Exit</span>
</form></div>
</div>
CSS:
div.parent
{
display: none;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
text-align: center;
font-family: 'Myriad Pro', Arial, sans-serif !important;
font-size: 22px !important;
border: 2px solid #aaa;
z-index: 1040;
-moz-box-shadow: 0px 0px 20px 2px #ccc;
-webkit-box-shadow: 0px 0px 20px 2px #ccc;
box-shadow: 0px 0px 20px 2px #ccc;
background: rgb(54, 25, 25); /* Fall-back for browsers that don't
support rgba */
background: rgba(255, 255, 255, .7);
}
div.downloadkit
{
position: fixed;
width: 200px;
height: 100px;
top: 50%;
left: 50%;
margin-left: -100px;
margin-top: -50px;
}
Then, on your home page of your site, add the following code: Note, this is jQuery, so just add the jquery library to your site, either in the header or just above the closing body tag -
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
Now add this code right below where you added jQuery:
<script type="text/javascript">
$(window).load(function(){ //this is pageload
$('div.parent').show(500); //500 is the animation speed
})
</script>
NOTE: If
$('div.parent').show(500);
does not work, try:
$('div.parent').css('display','block');

Related

CSS: Can't get submit button to center [duplicate]

This question already has answers here:
Center form submit buttons HTML / CSS
(11 answers)
Closed 5 years ago.
Very odd and I spent an hour today trying to figure out what I'm doing wrong. Have a email signup form. Four input fields and a submit button. In my design, the submit button should be centered under the four fields. However, instead the button is flush left aligned no matter whether I use or don't use float:left; or clear:both; or margin:0 auto; In other words, the usual suspects.
Here's the site. The form is on the bottom: http://ellismarsalis2017.jasonmarsalis.com/
Here's the code:
#footerForm {
position: relative;
float: none;
width: 728px;
height: auto;
margin: 0 auto;
padding: 18px auto 0;
}
footer form input {
float: left;
color: #2a358f;
width: 44%;
background: #edc53e;
border-radius: 8px;
margin: 0 2% 14px;
font-size: 18px;
padding: 0 .5%;
border: none;
}
footer form input.signUp {
font-family: "clarendon-urw", serif;
float: none!important;
clear: both;
background: #2a358f;
color: #edc53e;
margin: 0 auto;
font-size: 18px;
padding: 8px 24px;
border: none;
text-align: center;
}
footer p {
padding: 28px 0;
}
<div id="footerForm">
<form name="" method="post" action="http://www.yoursite.com/box.php">
<input name="name" type="text" id="name" value="Your Name">
<input name="field1" type="text" id="field1" value="Your City">
<input name="email" type="text" id="email" value="Your Email Address">
<input name="field2" type="text" id="field2" value="Your State">
<input name="p" type="hidden" id="p" value="7">
<input type="hidden" name="nlbox[1]" value="1">
<input type="submit" name="Submit" class="signUp" value="Sign me up for the Email List!">
</form>
</div>
You should put it on DIV section and make it's style text-align:center like that:
<div style="text-align:center;">
<input type="submit" name="Submit" class="signUp" value="Sign me up for the Email List!">
</div>
or with a class and css code :
HTML
<div class="submitsection">
<input type="submit" name="Submit" class="signUp" value="Sign me up for the Email List!">
</div>
CSS
.submitsection {
text-align:center;
}

Bootstrap 3 Placing Icon inside input field

I am working in Bootstrap 3 and am trying to get a calendar icon inside the right hand side of the input box.
My html looks like this:
<div class="col-md-12">
<div class='right-inner-addon col-md-2 date datepicker'
data-date-format="yyyy-mm-dd">
<input name='name' value="" type="text" class="form-control date-picker"
data-date-format="yyyy-mm-dd"/>
<i class="fa fa-calendar"></i>
</div>
</div>
I have tried position: absolute like this:
.right-inner-addon i {
position: absolute;
right: 5px;
top: 10px;
pointer-events: none;
font-size: 1.5em;
}
.right-inner-addon {
position: relative;
}
But when I do it will look great in one spot, but will not be positioned correctly in another instance.
I have also tried to see if I could use text-indent to see if this would work throughout, but it had the same effect.
.right-inner-addon i,
.form-group .right-inner-addon i {
display: inline-block;
z-index: 3;
text-indent: -15px;
font-size: 1.3em;
}
Here's a jsFiddle that might help
Using bootstrap's native validation states is probably preferable to writing custom CSS here.
And I'm pretty sure that I'm the one who came up with the CSS in question.
Just use .has-feedback on your form-group and .form-control-feedback on your icon:
<div class="form-group has-feedback">
<label class="control-label sr-only">DatePicker</label>
<input type="text" class="form-control date-picker" />
<i class="fa fa-calendar form-control-feedback"></i>
</div>
Demo in jsFiddle
You can use input-group add-on with a input-group-btn.
<div class="col-md-12">
<div class='input-group add-on col-md-2 date datepicker'
data-date-format="yyyy-mm-dd">
<input name='name' value="" type="text" class="form-control date-picker"
data-date-format="yyyy-mm-dd"/>
<div class="input-group-btn">
<button class="btn btn-default">
<i class="fa fa-calendar"></i>
</button>
</div>
</div>
</div>
With a little CSS to hide the button border:
/* remove border between controls */
.add-on .input-group-btn > .btn {
border-left-width: 0;
left:-2px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
/* stop the glowing blue shadow */
.add-on .form-control:focus {
-webkit-box-shadow: none;
box-shadow: none;
border-color:#cccccc;
}
Demo: http://bootply.com/128059
Check this fiddle, adapted from this answer
The difference being that in your case the <i> was placed after <input>. Swapping them makes it work. That's why the positioning was creating a mess as opposed to the cited answer.
In above answers, Input click works but click on i tag is not working.
so I have added my code in answer of #KyleMit
<div class="form-group has-feedback">
<input type="text" name="txtDatepicker" class="form-control date-picker" />
<i class="glyphicon glyphicon-calendar"
onclick="javascript:$('input[name=txtDatepicker]').data('DateTimePicker').show();">
</i>
</div>
I changed css little bit for my UI. You also can change it.
<style>
.right-inner-addon {
position: relative;
}
.right-inner-addon input {
padding-right: 30px;
}
.right-inner-addon i {
position: absolute;
left: 256px;
padding: 14px 12px;
}
</style>

Why isn't my css being applied to my checkbox when checked, but only when rendered by razor?

I took the following HTML:
<div class="small-6 columns">
<input id="temp-id-2" class="replace-checkbox" type="checkbox" checked="checked">
<label for="temp-id-2" class="checkbox-label">Taxable?</label>
</div>
And implemented it in razor:
<div class="small-6 columns">
#Html.CheckBoxFor(m => m.InventoryItem.Taxable, new { #class="replace-checkbox", id="temp-id-2" })
#Html.LabelFor(m => m.InventoryItem.Taxable, new { #class="checkbox-label", #for="temp-id-2" })
</div>
It is getting rendered like this:
<div class="small-6 columns">
<input checked="checked" class="replace-checkbox" data-val="true" data-val-required="The Taxable field is required." id="temp-id-2" name="InventoryItem.Taxable" type="checkbox" value="true" />
<input name="InventoryItem.Taxable" type="hidden" value="false" />
<label for="temp-id-2" class="checkbox-label">Taxable?</label>
</div>
And I have the following css:
form.app-form label.checkbox-label {
display: block;
visibility: visible;
font-weight: bold;
cursor: pointer;
color: #5c5c5c;
padding: 9px 10px;
padding-left: 40px;
background-repeat: no-repeat;
background-position: 10px center;
background-image: url("../images/field-check-inactive-10.png");
background-position: right center; padding-left: 10px;
}
form.app-form .replace-checkbox {
position: absolute;
overflow: hidden;
clip: rect(0 0 0 0);
height: 1px;
width: 1px;
margin: -1px;
padding: 0;
border: 0; }
form.app-form .replace-checkbox:checked + label.checkbox-label {
padding-left: 40px;
background-repeat: no-repeat;
background-position: 10px center;
background-image: url("../images/field-check-10.png");
background-position: right center;
padding-left: 10px;
}
When I run the plain HTML, I am able to check the checkbox and it changes from a greyed out check mark to a darkened in check mark. However, when I render it in razor, the checked state does not change. I noticed that the page is still detected that it is being checked because I can see the values change when I submit the form, but the css doesn't seem to get applied when it is in the checked state. I'm stumped. Any ideas?
As it turns out, the problem is with how MVC uses hidden fields to post data back to the controller. In this chunk:
<div class="small-6 columns">
<input checked="checked" class="replace-checkbox" data-val="true" data-val-required="The Taxable field is required." id="temp-id-2" name="InventoryItem.Taxable" type="checkbox" value="true" />
<input name="InventoryItem.Taxable" type="hidden" value="false" />
<label for="temp-id-2" class="checkbox-label">Taxable?</label>
</div>
It added the hidden field element which broke the css selector form.app-form .replace-checkbox:checked + label.checkbox-label which selects the label immediately following the checkbox. Since it no longer immediate follows the checkbox, it never gets applied.
My fix (for now) for this was to change the + to a ~

CSS Style Position id from javascript

I have a form with a validation script here http://www.goedkoopnaarschiphol.nl/bestellentest/bestellen-retour-schiphol/index.php
When you click on sent you see red message from validation script. When you take your screen on the right sight and move the screen it's getting wrong.
When I make from position: absolute in to relative I don’t see anything anymore
Please can anybody help me?
Hans
.info {
text-align: left;
padding: 5px;
font: normal 11px Verdana, Arial, Helvetica, sans-serif;
color: #fff;
position: absolute;
display: none;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: -1px 1px 2px #a9a9a9;
-moz-box-shadow: -1px 1px 2px #a9a9a9;
box-shadow: -1px 1px 2px #a9a9a9;
}
.error {
background: #f60000;
border: 3px solid #d50000;
}
.correct {
background: #56d800;
border: 3px solid #008000;
}
.wrong {
font-weight: bold;
color: #e90000;
}
.normal {
font-weight: normal;
color: #222;
}
<div>
<form id="jform" action="" method="post">
<fieldset>
<legend>Contactgegevens</legend>
<label>Voornaam:</label>
<input id="voornaam" name="Voornaam" /><br />
<label>Achternaam:</label>
<input id="achternaam" name="Achternaam" /><br />
<label>Straatnaam:</label>
<input id="straatnaam" name="Straat" /><br />
<label>Huisnummer:</label>
<input id="huisnummer" name="Huisnummer" /><br />
<label>Postcode:</label>
<input id="postcode" name="Postcode" /><br />
<label>Plaatsnaam:</label>
<input id="plaatsnaam" name="Plaats" /><br />
<label>Telefoon:</label>
<input id="telefoon" name="Telefoon" /><br />
<label>Mobiel<small> (06-1234567)</small>:</label>
<input id="mobiel" name="Mobiel" /><br />
<label>Vertrekdatum<small> (DD-MM-YYYY)</small>:</label>
<input id="vertrekdatum" name="Vertrekdatum" /><br />
<label>Ophaaltijd<small> (UU:MM):</small>:</label>
<input id="vertrektijd" name="Vertrektijd" /><br />
<label>Aankomstdatum<small> (DD-MM-YYYY)</small>:</label>
<input id="aankomstdatum" name="Aankomstdatum" /><br />
<label>Aankomsttijd <small> (UU:MM)</small>:</label>
<input id="aankomsttijd" name="Aankomsttijd" /><br />
<label>Vluchtnummer:</label>
<input id="vluchtnummer" name="Vluchtnummer" /><br />
<label>Vertrekland:</label>
<input id="vertrekland" name="Vertrek-land" /><br />
</fieldset>
<fieldset>
<legend>E-mail:</legend>
<label>E-mail<small> (piet#hotmail.com)</small>:</label>
<input id="mail" name="E-mail"/><br />
</fieldset>
<fieldset>
<legend>Opmerkingen</legend>
<label style="width: 100%; height: 17px">Heeft u vragen of opmerkingen, zet ze hier onder neer:</label>
<textarea style="width: 100%;" cols="" name="ritOpmerking" rows="4"></textarea>
</fieldset>
<button type="submit" id="send">Verzend uw aanvraag</button>
</form>
</div>
using position relative is the solution but in your case the boxs are relative to body,
for example try this on telefoon box
top: -719px;
left: 864px;
display: block;
position: relative;
width: 10px;
you have 2 options :
play with top and left with position relative (like in the example)
a cleaner solution is to have your correct box and the input in the same div so your position will be related to that div

fixed div with dynamic content not scrolling

I have a fixed div with dynamic loaded li elements. Now I want the div-content to scroll when there are more than 9 li elements and a scroll-bar:
This is what it looks like:
At the moment the fixed div goes on over the footer and the content can not be scrolled.
Here is the css for all divs:
#fixed-div {
position: fixed;
width: 30%;
margin-top:290px;
padding-top:20px;
padding-bottom: 20px; /* must be same height as the footer */
background-color: rgba(255, 255, 255, 0.60);
min-height: 100%;
}
#absolute-div {
padding: 15px;
background-color: rgba(255, 255, 255, 0.60);
margin-bottom: 10px;
position: relative;
height: 200px;
}
#footer {
position: relative;
margin-top: -33px; /* negative value of footer height */
height: 20px;
line-height: 33px;
border-bottom:20px solid #fff;
text-align: left;
background-color:#fff;
padding-left:10px;
}
#map_canvas { /* background */
clear:left;
float: left;
width: 100%;
min-height: 100%;
z-index:-1001;
/* height: 530px;*/
-webkit-box-shadow: 0px 0px 10px #888;
-moz-box-shadow: 0px 0px 10px #888;
}
And here's the HTML:
<body>
<div id="searchbox">
<div id="absolute-div" class="clear-block">
<form method="post" action="./index.php" accept-charset="UTF-8" method="post" id="clinic-finder-form" class="clear-block" class="clear-block">
<label for="edit-gmap-address">Standort angeben und Vorteile in der Umgebung finden: </label>
<input type="text" maxlength="128" name="address" id="address" size="60" value="" class="form-text" autocomplete="off" />
<?php
// support unicode
mysql_query("SET NAMES utf8");
$cats = $db->get_rows("SELECT categories.* FROM categories WHERE categories.id!='' ORDER BY categories.cat_name ASC");
?>
<select name="products" class="form-select" id="edit-products" ><option value="">Alle Kategorien</option>
<?php if(!empty($cats)): ?>
<?php foreach($cats as $k=>$v): ?>
<option value="<?php echo $v['id']; ?>"><?php echo $v['cat_name']; ?></option>
<?php endforeach; ?>
<?php endif; ?>
</select>
<input type="submit" name="op" id="edit-submit" value="Vorteile finden" class="btn btn-primary" />
<input type="hidden" name="form_build_id" id="form-0168068fce35cf80f346d6c1dbd7344e" value="form-0168068fce35cf80f346d6c1dbd7344e" />
<input type="hidden" name="form_id" id="edit-clinic-finder-form" value="clinic_finder_form" />
<input type="button" name="op" onclick="document.location.href='newstore.php'" id="edit-submit" value="Unternehmen vorschlagen" class="btn btn-primary" />
</form>
</div></div>
<div id="fixed-div">
<div id="clinic-finder" class="clear-block">
<div id="results">
<ol style="display: block; " id="list"></ol>
</div>
</div>
</div>
<div id="map_canvas"></div>
<div id="footer">© 2008-2013 Ihr Vorteilsclub - Impressum</div>
Thanks a lot! Marcel
Add this to your css:
#results {
height: 100%;
overflow-y: scroll; /* adds scrollbar */
}
You can do this with absolute positioning. You still need overflow-y: scroll. Absolutely position the top of the dynamic section to the total height of the fixed elements above it and the bottom to the total height of the fixed elements below it. May need to tweak slightly but that should do the trick of consuming all the intermediate space and scrolling the overflow.

Resources