javascript - Show div only on Homepage using only JS & CSS -
im trying show div on homepage, im using issue tracking software online allows customization. can use js , css. how can set div show on example.com/homepage , not on other page.
----------------here code-------------- js:
$('#mainarea') .before( '<div id="vmenu"><table width=900><tr><td width=50% rowspan=2>welcome software partner portal. click on “case status” see open cases, or “new case” submit new one.<br><br>the “wiki” option can find searchable reference material on variety of topics product documentation release notes , tips on issues.<br><br>if need please contact @ <a href="mailto:partners@example.com">partners@example.com</a> or 514.335.5525.</td></tr></table></div>' ); $('a.navlink[href*="default.asp?pre=prelogoff"]') .attr('href', 'http://www.example.com/login.php') $("table.biglist") .find("tr") .each(function() { $(this) .find("td:contains('closed')") .each(function() { $(this) .parent() .hide(); }); });
css:
#mainarea, mainareacontinued{ } #idlinktofogcreek { display:none; } table#mainarea { display:none; } #vmenu { width:900px; height:auto; margin:0 auto; background-color: #e0e9f1; border: 2px solid #b1c9dd; font-family: 'cambria',georgia,'times new roman',times,serif; } #vmenu ul { list-style:none; margin:0px; padding:5px; } #vmenu { text-decoration:none; font-size:12px; } #vmenu h4 { color:black; width:100%; font-weight:bold; border-bottom:solid 2px #f0f0f0; margin:0; } #vmenu a:hover { text-decoration:underline; } #vmenu li { margin-bottom:2px; }
try using condition:
if (location.href.indexof('homepage') !== -1) { //show div }
Comments
Post a Comment