javascript - Show content on certain URL -



javascript - Show content on certain URL -

i using online store solution allows me set simple online shop. cannot utilize code other html/css/javascript.

i have set in simple image-slider in template. want slider shown on frontpage. shown on every-page.

can utilize javascript functions says this: "if url "www.example.com" show image-slider else hide it."

something maybe?

<script> $(function() { if(document.url == "http://example.com/") { ... ... </script>

thanks on beforehand :)

i don't know exact circumstances of you're trying or why you'd need it, but

if (location.href == "http://example.com")

should it. location.href returns url of page, "document.url" in example.

if you're looking parts of url, cool tip found here.

var parser = document.createelement('a'); parser.href = "http://example.com:3000/pathname/?search=test#hash"; parser.hostname; // => "example.com" parser.pathname; // => "/pathname/"

essentially creates link element in javascript has properties homecoming different parts of url. relevant if there multiple urls index page. instance, if user @ http://example.com/index#something.

(location.href == "http://example.com/")

would homecoming false. however, if did in code,

var parser = document.createelement('a'); parser.href = "http://example.com/index#something"; (parser.hostname+parser.pathname == "example.com/index")

that lastly line homecoming true both http://example.com/index , http://example.com/index#something. taking info you've given website, here's best guess code should like.

var parser = document.createelement('a'); parser.href = location.href; if (parser.hostname+parser.pathname != "example.com/index") //if user isn't on index page { $(".slidewrap").hide(); //hide div class slidewrap }

javascript jquery

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -