I have an apps script that grabs a URL and returns it's contents. I want to then search the page for a specific string, before the javascript worked on the page. Then, I want to evaluate that same page after javascript has done it's thing.
The reason is that I have a 3rd-party script that replaces phone numbers on the page, based on region. I want to evaluate the original, before javascript source, to see if one of the replaceable numbers exists. If it does, I want check the after-javascript version to verify if it's been replaced with a number from that region.
I can do this manually by choosing "View Source" in the browser, then checking the Inspect Element where that string was found.
My problem is that I can't get the original source from UrlFetchApp. Is there a way to do that?
Thanks in advance,
Hans
--
Code
var doc = UrlFetchApp.fetch(url).getContentText();
// doc is the after-javascript version...
I just ran a test on an example website and found that UrlFetchApp does return the original source before JS rendering. I believe .fetch() works like a standard HTTP GET request, so I don't see why this wouldn't be the case.
Example: https://tutorialzine.com/2015/02/single-page-app-without-a-framework
UrlFetchApp Result Snippet:
<ul class="products-list">
<script id="products-template" type="x-handlebars-template">
{{#each this}}
<li data-index="{{id}}">
<img src="{{image.small}}" height="130" alt="{{name}}"/>
<h2> {{name}} </h2>
<ul class="product-description">
<li><span>Manufacturer: </span>{{specs.manufacturer}}</li>
<li><span>Storage: </span>{{specs.storage}} GB</li>
<li><span>OS: </span>{{specs.os}}</li>
<li><span>Camera: </span>{{specs.camera}} Mpx</li>
</ul>
<button>Buy Now!</button>
<p class="product-price">{{price}}$</p>
<div class="highlight"></div>
</li>
{{/each}}
</script>
</ul>
Post-JS Render Result:
<ul class="products-list">
<script id="products-template" type="x-handlebars-template">
{{#each this}}
<li data-index="{{id}}">
<img src="{{image.small}}" height="130" alt="{{name}}"/>
<h2> {{name}} </h2>
<ul class="product-description">
<li><span>Manufacturer: </span>{{specs.manufacturer}}</li>
<li><span>Storage: </span>{{specs.storage}} GB</li>
<li><span>OS: </span>{{specs.os}}</li>
<li><span>Camera: </span>{{specs.camera}} Mpx</li>
</ul>
<button>Buy Now!</button>
<p class="product-price">{{price}}$</p>
<div class="highlight"></div>
</li>
{{/each}}
</script>
<li data-index="1" class="">
<a href="#" class="product-photo"
><img
src="assets/images/sony-xperia-z3.jpg"
height="130"
alt="Sony Xperia Z3"
/></a>
<h2> Sony Xperia Z3 </h2>
<ul class="product-description">
<li><span>Manufacturer: </span>Sony</li>
<li><span>Storage: </span>16 GB</li>
<li><span>OS: </span>Android</li>
<li><span>Camera: </span>15 Mpx</li>
</ul>
<button>Buy Now!</button>
<p class="product-price">899$</p>
<div class="highlight"></div>
</li>
<li data-index="2" class="">
<a href="#" class="product-photo"
><img src="assets/images/iphone6.jpg" height="130" alt="Iphone 6"
/></a>
<h2> Iphone 6 </h2>
<ul class="product-description">
<li><span>Manufacturer: </span>Apple</li>
<li><span>Storage: </span>16 GB</li>
<li><span>OS: </span>iOS</li>
<li><span>Camera: </span>8 Mpx</li>
</ul>
<button>Buy Now!</button>
<p class="product-price">899$</p>
<div class="highlight"></div>
</li>
<li data-index="3" class="">
<a href="#" class="product-photo"
><img src="assets/images/htc-one.jpg" height="130" alt="HTC One M8"
/></a>
<h2> HTC One M8 </h2>
<ul class="product-description">
<li><span>Manufacturer: </span>HTC</li>
<li><span>Storage: </span>32 GB</li>
<li><span>OS: </span>Android</li>
<li><span>Camera: </span>5 Mpx</li>
</ul>
<button>Buy Now!</button>
<p class="product-price">899$</p>
<div class="highlight"></div>
</li>
<li data-index="4" class="">
<a href="#" class="product-photo"
><img
src="assets/images/galaxy-alpha.jpg"
height="130"
alt="Galaxy Alpha"
/></a>
<h2> Galaxy Alpha </h2>
<ul class="product-description">
<li><span>Manufacturer: </span>Samsung</li>
<li><span>Storage: </span>32 GB</li>
<li><span>OS: </span>Android</li>
<li><span>Camera: </span>12 Mpx</li>
</ul>
<button>Buy Now!</button>
<p class="product-price">899$</p>
<div class="highlight"></div>
</li>
<li data-index="5" class="">
<a href="#" class="product-photo"
><img
src="assets/images/nokia-lumia.jpg"
height="130"
alt="Nokia Lumia"
/></a>
<h2> Nokia Lumia </h2>
<ul class="product-description">
<li><span>Manufacturer: </span>Nokia</li>
<li><span>Storage: </span>16 GB</li>
<li><span>OS: </span>Windows</li>
<li><span>Camera: </span>5 Mpx</li>
</ul>
<button>Buy Now!</button>
<p class="product-price">450$</p>
<div class="highlight"></div>
</li>
<li data-index="6" class="">
<a href="#" class="product-photo"
><img src="assets/images/zte-nubia.jpg" height="130" alt="Zte Nubia"
/></a>
<h2> Zte Nubia </h2>
<ul class="product-description">
<li><span>Manufacturer: </span>ZTE</li>
<li><span>Storage: </span>32 GB</li>
<li><span>OS: </span>Android</li>
<li><span>Camera: </span>12 Mpx</li>
</ul>
<button>Buy Now!</button>
<p class="product-price">399$</p>
<div class="highlight"></div>
</li>
<li data-index="7" class="">
<a href="#" class="product-photo"
><img
src="assets/images/galaxy-s5.jpg"
height="130"
alt="Samsung Galaxy S5"
/></a>
<h2> Samsung Galaxy S5 </h2>
<ul class="product-description">
<li><span>Manufacturer: </span>Samsung</li>
<li><span>Storage: </span>16 GB</li>
<li><span>OS: </span>Android</li>
<li><span>Camera: </span>15 Mpx</li>
</ul>
<button>Buy Now!</button>
<p class="product-price">399$</p>
<div class="highlight"></div>
</li>
<li data-index="8" class="">
<a href="#" class="product-photo"
><img src="assets/images/iphone5s.jpg" height="130" alt="Iphone 5S"
/></a>
<h2> Iphone 5S </h2>
<ul class="product-description">
<li><span>Manufacturer: </span>Apple</li>
<li><span>Storage: </span>16 GB</li>
<li><span>OS: </span>iOS</li>
<li><span>Camera: </span>8 Mpx</li>
</ul>
<button>Buy Now!</button>
<p class="product-price">399$</p>
<div class="highlight"></div>
</li>
</ul>
Related
<div id="about" class="tm-content-box">
<ul class="boxes gallery-container">
<li class="box box-bg">
<h2 class="tm-section-title tm-section-title-box tm-box-bg-title">Consult</h2>
</li>
<li class="box">
<a href="https://dummyimage.com/50x50/000000/fff">
<img src="https://dummyimage.com/50x50/000000/fff" alt="Image" class="img-fluid thumbnail box-img">
</a>
</li>
<li class="box box-bg">
<h2 class="tm-section-title tm-section-title-box tm-box-bg-title">Design</h2>
</li>
<li class="box">
<a href="https://dummyimage.com/50x50/0000ff/fff">
<img src="https://dummyimage.com/50x50/0000ff/fff" alt="Image" class="img-fluid thumbnail box-img">
</a>
</li>
<li class="box box-bg">
<h2 class="tm-section-title tm-section-title-box tm-box-bg-title">Engineer</h2>
</li>
<li class="box">
<a href="https://dummyimage.com/50x50/00ff00/fff">
<img src="https://dummyimage.com/50x50/00ff00/fff" alt="Image" class="img-fluid thumbnail box-img">
</a>
</li>
<li class="box box-bg">
<h2 class="tm-section-title tm-section-title-box tm-box-bg-title">Operate</h2>
</li>
<li class="box">
<a href="https://dummyimage.com/50x50/ff0000/fff">
<img src="https://dummyimage.com/50x50/ff0000/fff" alt="Image" class="img-fluid thumbnail box-img">
</a>
</li>
<li class="box box-bg">
<h2 class="tm-section-title tm-section-title-box tm-box-bg-title">Optimize</h2>
</li>
</ul>
</div>
What combinator selects each img with a class "box-img" in order to replace each with another?
#about .box-img:nth-child(1){
background-image: url(../img/img-1.jpg);}
But it doesn't work.
Could it be the resolution of the images? The original ones are 250 × 250 and the ones I want to replace with are 600 × 400.
Is there a way to replace each image using only CSS?
You should just use JavaScript to update the src attribute instead. Here a short script that will change all images to another after two seconds.
window.addEventListener("DOMContentLoaded", (e) => {
const imgs = document.querySelectorAll("#about .box-img:nth-child(1)");
const newImage = "https://dummyimage.com/100x100/ff00ff/000000&text=Changed"
// set image to another one after two seconds
setTimeout(() => {
imgs.forEach(img => img.setAttribute("src", newImage))
}, 2000)
});
<div id="about" class="tm-content-box">
<ul class="boxes gallery-container">
<li class="box box-bg">
<h2 class="tm-section-title tm-section-title-box tm-box-bg-title">Consult</h2>
</li>
<li class="box">
<a href="https://dummyimage.com/50x50/000000/fff">
<img src="https://dummyimage.com/50x50/000000/fff" alt="Image" class="img-fluid thumbnail box-img">
</a>
</li>
<li class="box box-bg">
<h2 class="tm-section-title tm-section-title-box tm-box-bg-title">Design</h2>
</li>
<li class="box">
<a href="https://dummyimage.com/50x50/0000ff/fff">
<img src="https://dummyimage.com/50x50/0000ff/fff" alt="Image" class="img-fluid thumbnail box-img">
</a>
</li>
<li class="box box-bg">
<h2 class="tm-section-title tm-section-title-box tm-box-bg-title">Engineer</h2>
</li>
<li class="box">
<a href="https://dummyimage.com/50x50/00ff00/fff">
<img src="https://dummyimage.com/50x50/00ff00/fff" alt="Image" class="img-fluid thumbnail box-img">
</a>
</li>
<li class="box box-bg">
<h2 class="tm-section-title tm-section-title-box tm-box-bg-title">Operate</h2>
</li>
<li class="box">
<a href="https://dummyimage.com/50x50/ff0000/fff">
<img src="https://dummyimage.com/50x50/ff0000/fff" alt="Image" class="img-fluid thumbnail box-img">
</a>
</li>
<li class="box box-bg">
<h2 class="tm-section-title tm-section-title-box tm-box-bg-title">Optimize</h2>
</li>
</ul>
</div>
As you can see different image sizes do not hinder you from doing this. You could obviously adjust the logic to do more complicated (yet simple) stuff than replacing all images with the same image but the principle remains the same.
I am trying to avoid fixed height of bootstrap columns. I do have a Custom Mega Menu in my project where we show all our Nav bar entries. This one is a dynamically created code so it will be difficult to change the logic of the Mega menu creation so I am looking for some Css solution to fix this issue.
My code in high level look like.
<div class="row">
<div class="col-xl-3">... contents </div>
<div class="col-xl-3">... contents </div>
<div class="col-xl-3">... contents </div>
<div class="col-xl-3">... contents </div>
<div class="col-xl-3">... contents </div>
<div class="col-xl-3">... contents </div>
</div>
Since this one is a dynamic item we can expect n number of col-xl-3
The issue is I am getting some extra space in between columns. ( taking the max size item's size in each row)
As you can see in the image attached, The yellow color marked area I am trying to avoid.
I have tried to use d-block with float-left to the child elements.
Then I am getting display something like below.
Here also I am getting extra space in some places. Is there any way to get out of this issues?
What I am looking for is to move sections 5 to below 1 st section and 6 one to below 2 nd section etc .And remove the extra space between top and bottom columns
(the yellow highlighted space in the image)
I am adding a testing sample below here.
<html lang="en">
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"
type="text/css">
</head>
<div class="container-outer">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12 col-md-12 col-12 navtop">
<nav class="navbar navbar-expand-lg navbar-light">
<div id="navbarContent" class="collapse navbar-collapse flex-md-column">
<ul class="navbar-nav mr-auto second-ul">
<ul class="navbar-nav treemenu">
<li class="nav-item dropdown position-static">
<a class="nav-link mnn-nav-link channelclass" href="#" id="navbarDropdown"
role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
MENU
<i class="fa fa-down"></i>
</a>
<div class="dropdown-menu w-100 ddn" aria-labelledby="navbarDropdown">
<div class="row d-block">
<div class="col-xl-3 float-left">
<p data-id="ACCT" class="submenu-title mnn-sdaaaent-nav-click">
1
<i class="sub-up-down fa-up fa"></i>
</p>
<ul class="list-unstyled ACCT ">
<li>
<a class="mnn-nav-sub-click" data-id="IPASSBOOKACCT">
seffwew
<i class="fa fa-down"></i>
</a>
<ul class="list-unstyled seffwewACCT mnn-nav-ul-sub" style="display: none;">
<li>
General Information
</li>
<li>
sefscsdsd Summary
</li>
<li>
Transaction
</li>
</ul>
</li>
<li>
sfdsfsds Income
</li>
</ul>
</div>
<div class="col-xl-3 float-left">
<p data-id="TAX" class="submenu-title mnn-sdaaaent-nav-click">
2
<i class="sub-up-down fa-up fa"></i>
</p>
<ul class="list-unstyled TAX ">
<li>
2019 sdfdsfsfsdfs Forms
<sup class="newtext">NEW</sup>
</li>
<li>
<a target="_blank" href="/Commonfiles/2019/2019POFManual.pdf">2019 POF Manual</a>
<sup class="newtext">NEW</sup>
</li>
<li>
Estimated Composite sdfdsfsfsdfses 4th Qtr Election
</li>
<li>
ds sfsdsdsd and Consent
</li>
<li>
NY IT-2658 Estimate
</li>
<li>
State sdfdsfsfsdfs Questionnaire
</li>
<li>
sdfdsfsfsdfs Presdaaaation Sign-Up
</li>
<li>
<a class="mnn-nav-sub-click" data-id="ARCHIVES">
Archives
<i class="fa fa-down"></i>
</a>
<ul class="list-unstyled ARCHIVES mnn-nav-ul-sub" style="display: none;">
<li>
2018 sdfdsfsfsdfs Forms
</li>
<li>
<a target="_blank" href="/Commonfiles/2018/2018POFManual.pdf">2018 POF Manual</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/2018/2018SampleForms965and965-A.PDF">2018 dfgdfgdg Manual addendum-Sample Forms 965 and 965-A</a>
</li>
<li>
Section 965 State by State Instructions
</li>
<li>
2017 sdfdsfsfsdfs Forms
</li>
<li>
<a target="_blank" href="/Commonfiles/2017/Sec965FAQ.pdf">Section 965 FAQs</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/2017/2017dfgdfgdgManual.pdf">2017 dfgdfgdg Manual</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/2017/2017sdfdsfsfsdfs_Information.pdf">2017 sdfdsfsfsdfs Information</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/2017/2017dfgdfgdgManualAddendum965TransitionsdfdsfsfsdfsREVISED101218.pdf">2017 dfgdfgdg Manual Addendum 965 Transition sdfdsfsfsdfs revised 101218</a>
</li>
<li>
2016 sdfdsfsfsdfs Forms
</li>
<li>
<a target="_blank" href="/Commonfiles/2016/2016_sdfdsfsfsdfsInformation.pdf">2016 sdfdsfsfsdfs Information</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/2016/2016dfgdfgdgManual.pdf">2016 dfgdfgdg Manual</a>
</li>
<li>
2015 sdfdsfsfsdfs Forms
</li>
<li>
<a target="_blank" href="/Commonfiles/2015/2015sdfdsfsfsdfsInformation.pdf">2015 sdfdsfsfsdfs Information</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/2015/2015dfgdfgdgManual.pdf">2015 dfgdfgdg Manual</a>
</li>
<li>
2014 sdfdsfsfsdfs Forms
</li>
<li>
<a target="_blank" href="/Commonfiles/2014/2014sdfdsfsfsdfsInformation.pdf">2014 sdfdsfsfsdfs Information</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/2014/2014dfgdfgdgManual.pdf">2014 dfgdfgdg Manual</a>
</li>
<li>
2013 sdfdsfsfsdfs Forms
</li>
<li>
<a target="_blank" href="/CommonFiles/2013/2013sdfdsfsfsdfsInformation.pdf">2013 sdfdsfsfsdfs Information</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/2013/2013dfgdfgdgManual.pdf">2013 dfgdfgdg Manual</a>
</li>
<li>
2012 sdfdsfsfsdfs Forms
</li>
<li>
<a target="_blank" href="/CommonFiles/2012/2012sdfdsfsfsdfsInformation.pdf">2012 sdfdsfsfsdfs Information</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/2012/2012dfgdfgdgManual.pdf">2012 dfgdfgdg Manual</a>
</li>
<li>
2011 sdfdsfsfsdfs Forms
</li>
<li>
<a target="_blank" href="/CommonFiles/2011/2011sdfdsfsfsdfsInformation.pdf">2011 sdfdsfsfsdfs Information</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/2011/2011dfgdfgdgManual.pdf">2011 dfgdfgdg Manual</a>
</li>
</ul>
</li>
</ul>
</div>
<div class="col-xl-3 float-left">
<p data-id="FINPLANPTR" class="submenu-title mnn-sdaaaent-nav-click">
3
<i class="sub-up-down fa-up fa"></i>
</p>
<ul class="list-unstyled FINPLANPTR ">
<li>
dfgdfgdg-dfgdgdfgdfg Planning Services sfsdsdsd
</li>
</ul>
</div>
<div class="col-xl-3 float-left">
<p data-id="ADM" class="submenu-title mnn-sdaaaent-nav-click">
4
<i class="sub-up-down fa-up fa"></i>
</p>
<ul class="list-unstyled ADM ">
<li>
<a target="_blank" href="/Commonfiles/dfdfs/DirectAdmitBook.pdf">Direct dfdfs Manual</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/dfdfs/NewsdsdsdManual.pdf">New sdsdsd & Principal Manual</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/dfdfs/sdsdsdshipagreements.pdf">sdsdsdship Agreements</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/dfdfs/Americas_Operating_Agreement_as_amended_July_4_2015.pdf">Americas Operating Agreement</a>
</li>
</ul>
</div>
<div class="col-xl-3 float-left">
<p data-id="RET" class="submenu-title mnn-sdaaaent-nav-click">
5
<i class="sub-up-down fa-up fa"></i>
</p>
<ul class="list-unstyled RET ">
<li>
<a class="mnn-nav-sub-click" data-id="SPDS">
Summary Plan Descriptions (sdssdsd)
<i class="fa fa-down"></i>
</a>
<ul class="list-unstyled sdssdsd mnn-nav-ul-sub" style="display: none;">
<li>
<a target="_blank" href="/Commonfiles/sdsdaa/TYU sdsdsdship sdsdaa Plan - HR-10 Plan - 2016.pdf">TYU sdsdsdship sdsdaa Plan -HR10-Plan</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/sdsdaa/TYU sdsdaa Savings Plan -401(k) sdsdsd-principles - 2016.pdf">TYU sdsdaa Savings Plan-401(k)</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/sdsdaa/TYU PDBRP and IDBRP 2017.pdf">TYU PDBRP and IDBRP</a>
</li>
</ul>
</li>
<li>
<a href="/sdsdaa/401kContribution/_401kExclusionMsg">
401(k) asdaaa and
Election
</a>
</li>
<li>
<a class="mnn-nav-sub-click" data-id="sdssdsd">
Summary Plan Descriptions (sdssdsd)
<i class="fa fa-down"></i>
</a>
<ul class="list-unstyled sdssdsd mnn-nav-ul-sub" style="display: none;">
<li>
<a target="_blank" href="/Commonfiles/sdsdaa/TYU sdsdsdship sdsdaa Plan - HR-10 Plan - 2016.pdf">TYU sdsdsdship sdsdaa Plan -HR10-Plan</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/sdsdaa/TYU sdsdaa Savings Plan -401(k) sdsdsd-principles - 2016.pdf">TYU sdsdaa Savings Plan-401(k)</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/sdsdaa/TYU PDBRP and IDBRP 2017.pdf">TYU asdadad and sdfsfsdsd</a>
</li>
</ul>
</li>
</ul>
</div>
<div class="col-xl-3 float-left">
<a target="_blank" class="submenu-title mnn-sdaaaent-nav-click" href="https://sdaaa.TYU.net">6</a>
</div>
<div class="col-xl-3 float-left">
<a class="submenu-title mnn-sdaaaent-nav-click" href="https://ptrshpdashboard.TYU.net">7</a>
</div>
</div>
</div>
</li>
</ul>
</ul>
</div>
</nav>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script>
$(document).ready(function () {
$("#navbarContent").hide();
$('.navtrigger').click(function () {
$("#navbarContent").toggle();
$(this).toggleClass('active');
$("#mainListDiv").toggleClass("show_list");
$("#mainListDiv").fadeIn();
});
setTimeout(function () {
$('body').addClass('loaded');
}, 100);
});
$(".mnn-nav-ul-sub").hide();
$(".mnn-nav-sub-click").click(function () {
$(".mnn-nav-ul-sub").slideToggle();
$(this).find('i').toggleClass('fa fa-down fa fa-up');
$(".mnn-nav-sub-click").sdaaaent().removeClass('navactive');
});
$(".ddn").on("click", function (e) {
e.stopPropagation();
});
</script>
</body>
</html>
maybe this helps you CSS: remove empty Space between boxes
In your case
.wrapper {
column-count: 3;
column-gap: 1.25rem;
}
.part {
break-inside: avoid-column;
position: relative;
display: inline-block;
width: 100%;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
flex-direction: column;
}
.row will be .wrapper and .col-xl-3 is .part, I recommend you not to use bootstrap classes for this
I'm trying to keep a child DIV from extending over the parent....the DIV in question is the one seen below labeled with id="2".....it goes past the parent DIV and goes all the way to the bottom of the page/browser window. I've modified the height, adding padding, changed location of the DIV and nothing works....not sure what to try next:
<div id="2" style="width:15%; height:90%; padding:10px; background-color:#2A7FAA; float:right; margin-top:200px"></div>
<div style="background-color:#FFF; border:thick; border-width:thick;">
<div style="margin-left:250px;">
<img style="padding:2em;" alt="ASH Banner" src="images/banner.png" class="banner"> <img style="padding:2em;" alt="ASH Banner" src="images/dsh-logo.png" class="logo">
</div>
</div>
<div style="height:15px; background-color:#2A7FAA"></div>
<div style="margin-left:150px; background:#CCC">
<div class="dropdown">
<button class="dropbtn" style="background-color:transparent">HOME
</button>
</div>
<div class="dropdown">
<button class="dropbtn" style="background-color:transparent">PERSONNEL
</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
<div class="dropdown">
<button class="dropbtn" style="background-color:transparent">INSURANCE
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
<div class="dropdown">
<button class="dropbtn" style="background-color:transparent">WORKERS COMP
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
<div class="dropdown">
<button class="dropbtn" style="background-color:transparent">EMPLOYMENT<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
<div class="dropdown">
<button class="dropbtn" style="background-color:transparent">BENEFIT PREMIUMS<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
</div>
<hr / style="border-width: 2px; width:800px; margin-right:9em;">
<div style="margin-top:3em">
<div style="width: 800px; margin: 0 auto;">
<p>Text Goes Here Text Goes Here Text Goes Here</p>
</div>
</div>
<div style="width: 800px; margin: 0 auto;">
<div class="cbox" style="left: 320px; top: 150px; width: 622px;">
<table>
<tr>
<td><img class="center" alt="" src="images/sponsor-dot.gif" width="15" /> <span onClick="openClose('a1')" style="cursor:hand; cursor:pointer; color: #33F; text-decoration:underline">Personnel Contacts</span>
<div id="a1" class="texter">
<ul class="style3">
<li class="listbox">Personnel Phone List</li>
<li class="listbox">Payroll Partners</li>
<li class="listbox">Personnel Specialist Work Assignments</li>
<li class="listbox">Work Area by Payroll Reporting Unit</li>
</ul>
</div>
</td>
</tr>
<tr>
<td><img class="center" alt="" src="images/sponsor-dot.gif" width="15" /> <span onClick="openClose('a2')" style="cursor:hand; cursor:pointer; color: #33F; text-decoration:underline">Insurance Information</span>
<div id="a2" class="texter">
<ul class="style3">
<li class="listbox"><a href='User_Area/HR/BenefitsWorksheet2017.pdf'>Benefits Worksheet </a></li>
<li class="listbox"><a href='http://eservices.calhr.ca.gov/BenefitsCalculatorExternal/'>Benefit Premium Calculator </a></li>
<li class="listbox"><a href='http://www.calhr.ca.gov/employees/pages/new-employee-benefits-orientation.aspx'>New Employee Benefits Orientation </a></li>
<li class="listbox"><a href='user_area/hr/HealthInsuranceMarketplaceCoverageOptions.pdf'>Health Insurance Marketplace Coverage Options </a></li>
<li class="listbox"><a href='user_area/hr/2018HighlightsAndChanges.pdf'>2018 Plan Highlights and Changes</a></li>
<li class="listbox"><a href='user_area/hr/DentalHandbook2017.pdf'>Dental Handbook 2017</a></li>
<li class="listbox"><a href='user_area/hr/DentalHandbook2018.pdf'>Dental Handbook 2018</a></li>
<li class="listbox"><a href='user_area/hr/CobenHandbook2017.pdf'>COBEN Handbook 2017</a></li>
<li class="listbox"><a href='user_area/hr/CobenHandbook2018.pdf'>COBEN Handbook 2018</a></li>
<li class="listbox"><a href='user_area/hr/FlexElectHandbook2017.pdf'>Flex Elect Handbook 2017</a></li>
<li class="listbox"><a href='user_area/hr/FlexElectHandbook2018.pdf'>Flex Elect Handbook 2018</a></li>
<li class="listbox"><a href='user_area/hr/Open_Enrollment_Event_Flyer.pdf'>2017-18 Open Enrollment Event 9/11/17 12pm-2pm</a></li>
<li class="listbox"><a href='user_area/hr/Open_Enrollment_Newsletter.pdf'>CalPERS 2017-18 Open Enrollment Newsletter</a></li>
</ul>
</div>
</td>
</tr>
<tr>
<td><img class="center" alt="" src="images/sponsor-dot.gif" width="15" /> <span onClick="openClose('a14')" style="cursor:hand; cursor:pointer; color: #33F; text-decoration:underline">Employment</span>
<div id="a14" class="texter">
<ul class="style3">
<li class="listbox">Training and Experience (T&E) Assessment Instructions</li>
<li class="listbox">Examination/Employment Application</li>
<li class="listbox">Exam Announcements</li>
<li class="listbox">Vacancy Listings</li>
<li class="listbox">CalHR Best Hiring Practices</li>
<li class="listbox">Authorization to Obtain Employment Reference Information</li>
<li class="listbox">Pre-Employment Reference Checklist</li>
</ul>
</div>
<p> </p>
</td>
</tr>
</table>
</div>
</div>
I'm trying to put a linkable image into my header RIGHT underneath the phone number but its not working. My question is where do I place the div and how do I style it?
The code for me current header is:
<div class="header-right">
<div class="social">
<!--social media icons-->
<ul>
<li>
<a class="contact" href="http://" title="Contact Us"></a>
</li>
<li>
<a class="google" href="http:/" target="_blank" title="Share on Google+"></a>
</li>
<li>
<a class="facebook" href="http:/" target="_blank" title="Share on Facebook"></a>
</li>
<li>
<a class="twitter" href="http:/" target="_blank" title="Share on Twitter"></a>
</li>
</ul>
</div>
<div class="telephone">
<p class="tel">Speak with<br/>
<?php bloginfo( 'description' ); ?><br />
<small>Available 08:30 - 17:00, Mon-Fri</small>
</p>
</div>
</div>
<div class="header-right">
<div class="social">
<!--social media icons-->
<ul>
<li>
<a class="contact" href="http://" title="Contact Us"></a>
</li>
<li>
<a class="google" href="http:/" target="_blank" title="Share on Google+"></a>
</li>
<li>
<a class="facebook" href="http:/" target="_blank" title="Share on Facebook"></a>
</li>
<li>
<a class="twitter" href="http:/" target="_blank" title="Share on Twitter"></a>
</li>
</ul>
</div>
<div class="telephone">
<p class="tel">Speak with<br/>
info<br />
<div>an image</div>
<small>Available 08:30 - 17:00, Mon-Fri</small>
</p>
</div>
</div>
I have created web application where I want to highlight the menu selected.
Below is what I have
<div style="width: 80%;" align="left" >
<span style="display:inline-block;" align="left" >
<div id="menubar" class="grid-block">
<nav id="menu">
<ul class="menu menu-dropdown ">
<li class="level1 item101 active">
<a href="index.xhtml" class="level1">
<span>
<span class="icon" style="background-image: url('images/menu/icon_menu_home.png');background-repeat: no-repeat; background-position: top center">
</span>
Home
</span>
</a>
</li>
<li class="level1 item102 parent makeSpace default"
style="#{!PersonalInformationDataBean.pageViewData.contains('registerForPatentss') && !PersonalInformationDataBean.pageViewData.contains('success') && !PersonalInformationDataBean.pageViewData.contains('getReportss') && !PersonalInformationDataBean.pageViewData.contains('searhPatentss') ?'display:none':'display:inherit'};">
<a href="" class="level1 parent">
<span>
<span class="icon" style="background-image: url('images/menu/icon_menu_features.png');background-repeat: no-repeat; background-position: top center">
</span>Projects/Inventions
</span>
</a>
<div class="dropdown columns1">
<div class="dropdown-bg" style="overflow: hidden; width: 239px; height: 202px; ">
<div>
<div class="width100 column">
<ul class="level2">
<li class="level2 item200" style="width: 210px;#{PersonalInformationDataBean.pageViewData.contains('registerForPatentss')?'display:inherit':'display:none'}">
<a href="registerForPatentss.xhtml" class="level2">
<span>Register New Applicant
</span>
</a>
</li>
<li class="level2 item201" style="width: 210px;#{PersonalInformationDataBean.pageViewData.contains('success')?'display:inherit':'display:none'}">
<a href="success.xhtml" class="level2">
<span>Register New Project
</span>
</a>
</li>
<li class="level2 item202" style="width: 210px;#{PersonalInformationDataBean.pageViewData.contains('getReportss')?'display:inherit':'display:none'}">
<a href="getReportss.xhtml" class="level2">
<span>Project Reports
</span>
</a>
</li>
<li class="level2 item203" style="width: 210px;#{PersonalInformationDataBean.pageViewData.contains('searhPatentss')?'display:inherit':'display:none'}">
<a href="searhPatentss.xhtml" class="level2">
<span>Search For Project
</span>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</li>
<li class="level1 item102 parent makeSpace default" style="#{!PersonalInformationDataBean.pageViewData.contains('systemLog') && !PersonalInformationDataBean.pageViewData.contains('addUser') && !PersonalInformationDataBean.pageViewData.contains('changePass') && !PersonalInformationDataBean.pageViewData.contains('userlistss')?'display:none':'display:inherit'}">
<a href="" class="level1 parent">
<span>
<span class="icon" style="background-image: url('images/menu/icon_menu_features.png');background-repeat: no-repeat; background-position: top center">
</span>Administrative
</span>
</a>
<div class="dropdown columns1">
<div class="dropdown-bg" style="overflow: hidden; width: 209px; height: 202px; ">
<div>
<div class="width100 column">
<ul class="level2">
<li class="level2 item200" style="width: 180px;#{PersonalInformationDataBean.pageViewData.contains('addUserss')?'display:inherit':'display:none'}">
<a href="addUserss.xhtml" class="level2">
<span>Add User Account
</span>
</a>
</li>
<li class="level2 item201" style="width: 180px;#{PersonalInformationDataBean.pageViewData.contains('logPatentSystemss')?'display:inherit':'display:none'}">
<a href="logPatentSystemss.xhtml" class="level2">
<span>System Log
</span>
</a>
</li>
<li class="level2 item202" style="width: 180px;#{PersonalInformationDataBean.pageViewData.contains('changePass')?'display:inherit':'display:none'}">
<a href="changePass.xhtml" class="level2">
<span>Change Password
</span>
</a>
</li>
<li class="level2 item203" style="width: 180px;#{PersonalInformationDataBean.pageViewData.contains('userlistss')?'display:inherit':'display:none'}">
<a href="userlistss.xhtml" class="level2">
<span>Details Of Registered Users
</span>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</li>
</ul>
</nav>
</div>
</span>
</div>
This gives me output as below (its not same, but somewhat like this).
Home | Projects | Administrative
| |
| |
|- Men 1 |- Ad 1
|- Men 2 |- Ad 2
|- Men 3 |- Ad 3
Now what I want to do is
When Men 1 is selected, <li class="level1 item102 parent makeSpace default" should change to <li class="level1 item102 parent makeSpace active" i.e. take out default and take in active class.
When I click on Ad 2, <li class="level1 item102 parent makeSpace default" should change to <li class="level1 item102 parent makeSpace active"
Any idea how to get this done? I check online, however examples I get was for Level 0 menu.
See The demo
jQuery:
$("#menubar").on("click","li",function(e){
e.preventDefault();
e.stopPropagation();
if($(this).hasClass("active"))
{
$(this).removeClass("active").addClass("default");
}
else
{
$(this).addClass("active").removeClass("default");
}
});
What I did is is below....
var myURL = window.location.toString();
var endIndex = myURL.lastIndexOf(".", myURL);
var startIndex = myURL.lastIndexOf("/")+1;
var pageAccessed = myURL.substr(startIndex, endIndex-startIndex);
if (pageAccessed=="successLoginss") {
$(".homemenu").addClass("active");
$(".homemenu").removeClass("default");
}
<li class="level1 item101 default homemenu">
<a href="index.xhtml" class="level1">
<span>
<span class="icon" style="background-image: url('images/menu/icon_menu_home.png');background-repeat: no-repeat; background-position: top center">
</span>
Home
</span>
</a>
</li>
Dats it..... I know this is not right way, but I had to get done this way....