Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jun 25, 2012 02:00 PM by azhar.rabi
0 Points
6 Posts
Jun 22, 2012 09:01 AM|LINK
Hi Guy's, Im looking for a little help if you dont mind.
I know very little about website code but getting taught very slowly......
I have a piece of script that I would need to place on my website to conform to European law.
What I need the code to do is hide the item after a set amount of time IE: 6 or 10 seconds.
And to be in front of other items on my website, as it hides part of it behide other things.
The code I have is below:
<link rel="stylesheet" type="text/css" href="http://www.thehostingfolks.com/cookiemain.css"/>
<script type="text/javascript" src="http://www.thehostingfolks.com/support-opt-in.js"></script>
<script type="text/javascript" src="http://www.thehostingfolks.com/require-opt-in.js" read_more="http://www.mywebsite.co.uk/page/privacy_policy/"></script>
Please can anyone crack this for me.
All-Star
15346 Points
3142 Posts
Jun 22, 2012 10:36 AM|LINK
in JS there a method
setTimeOut("script or funciton ",1000) 1000 is equal to 1 second we need to specify in milli second.
so after one second the "script or funciton " will get executed
$("div").show(); -- to show a div
$("div").hide(); -- to hide a div
Jun 22, 2012 10:39 AM|LINK
Hi Mudasir, thank you for the information.
How and where do I add that to my code? Would you be so kind as to show me where on my code above I place your code.
Thank you in advance.
Member
146 Points
26 Posts
Jun 22, 2012 08:20 PM|LINK
if you are using jquery you can use $(document).ready to function setTimeOut("YOUR SCRIPT HERE ",1000);
1000 = 1 Sec
$(document).ready(function() { setTimeOut("script or funciton ",1000) ; });
OR
if you are using AJAX than you can write the above code as
function pageLoad()
{
setTimeOut("script or funciton ",1000) ;
}
setTimeout JQuery hide show
Jun 22, 2012 08:48 PM|LINK
Still cant get it to work, can someone add my script to the code also, so that I know where everything goes.
That way i can copy and paste to my code and try. Sorry im not very up on this subject.
MY CODE:
<linkrel="stylesheet"type="text/css"href="http://www.thehostingfolks.com/cookiemain.css"/>
<scripttype="text/javascript"src="http://www.thehostingfolks.com/support-opt-in.js"></script>
<scripttype="text/javascript"src="http://www.thehostingfolks.com/require-opt-in.js"read_more="http://www.mywebsite.co.uk/page/privacy_policy/"></script>
Jun 22, 2012 09:37 PM|LINK
Can you please post your complete code and please mention which div or html area you want to hide.
Jun 22, 2012 10:16 PM|LINK
Hi Azhar, Im trying to place this widget on my website to comply with EU law. See this website for widget: http://www.thehostingfolks.com/blog/?p=185
But I would like to make it autohide after something like 6 seconds, like the one you can confiure on this website: http://www.civicuk.com/cookie-law/index
But not sure how to write the full code.
Jun 25, 2012 02:00 PM|LINK
This code runs when someone clicks on Argee button,
agree_button.onclick = function() { var expires = new Date(); expires.setFullYear(expires.getFullYear() + 5); document.cookie = "eu-opt-in=1" + "; path=/; expires=" + expires.toUTCString(); HI.optInCookies.showSplash(); if(HI.optInCookies.onAgree) HI.optInCookies.onAgree(); };
You can use the above code to set agree and hide the control.
$(document).ready(function() { setTimeOut("AgreeAndHide();",6000) ; }); function AgreeAndHide(){ var expires = new Date(); expires.setFullYear(expires.getFullYear() + 5); document.cookie = "eu-opt-in=1" + "; path=/; expires=" + expires.toUTCString(); HI.optInCookies.showSplash(); if(HI.optInCookies.onAgree) HI.optInCookies.onAgree(); }
Scoot
0 Points
6 Posts
JQuery code...What am I missing
Jun 22, 2012 09:01 AM|LINK
Hi Guy's, Im looking for a little help if you dont mind.
I know very little about website code but getting taught very slowly......
I have a piece of script that I would need to place on my website to conform to European law.
What I need the code to do is hide the item after a set amount of time IE: 6 or 10 seconds.
And to be in front of other items on my website, as it hides part of it behide other things.
The code I have is below:
<link rel="stylesheet" type="text/css" href="http://www.thehostingfolks.com/cookiemain.css"/>
<script type="text/javascript" src="http://www.thehostingfolks.com/support-opt-in.js"></script>
<script type="text/javascript" src="http://www.thehostingfolks.com/require-opt-in.js" read_more="http://www.mywebsite.co.uk/page/privacy_policy/"></script>
Please can anyone crack this for me.
Mudasir.Khan
All-Star
15346 Points
3142 Posts
Re: JQuery code...What am I missing
Jun 22, 2012 10:36 AM|LINK
in JS there a method
setTimeOut("script or funciton ",1000) 1000 is equal to 1 second we need to specify in milli second.
so after one second the "script or funciton " will get executed
$("div").show(); -- to show a div
$("div").hide(); -- to hide a div
Scoot
0 Points
6 Posts
Re: JQuery code...What am I missing
Jun 22, 2012 10:39 AM|LINK
Hi Mudasir, thank you for the information.
How and where do I add that to my code? Would you be so kind as to show me where on my code above I place your code.
Thank you in advance.
azhar.rabi
Member
146 Points
26 Posts
Re: JQuery code...What am I missing
Jun 22, 2012 08:20 PM|LINK
if you are using jquery you can use $(document).ready to function setTimeOut("YOUR SCRIPT HERE ",1000);
1000 = 1 Sec
$(document).ready(function() {
setTimeOut("script or funciton ",1000) ;
});
OR
if you are using AJAX than you can write the above code as
function pageLoad()
{
setTimeOut("script or funciton ",1000) ;
}
setTimeout JQuery hide show
Scoot
0 Points
6 Posts
Re: JQuery code...What am I missing
Jun 22, 2012 08:48 PM|LINK
Still cant get it to work, can someone add my script to the code also, so that I know where everything goes.
That way i can copy and paste to my code and try. Sorry im not very up on this subject.
MY CODE:
<linkrel="stylesheet"type="text/css"href="http://www.thehostingfolks.com/cookiemain.css"/>
<scripttype="text/javascript"src="http://www.thehostingfolks.com/support-opt-in.js"></script>
<scripttype="text/javascript"src="http://www.thehostingfolks.com/require-opt-in.js"read_more="http://www.mywebsite.co.uk/page/privacy_policy/"></script>
azhar.rabi
Member
146 Points
26 Posts
Re: JQuery code...What am I missing
Jun 22, 2012 09:37 PM|LINK
Can you please post your complete code and please mention which div or html area you want to hide.
Scoot
0 Points
6 Posts
Re: JQuery code...What am I missing
Jun 22, 2012 10:16 PM|LINK
Hi Azhar, Im trying to place this widget on my website to comply with EU law. See this website for widget: http://www.thehostingfolks.com/blog/?p=185
But I would like to make it autohide after something like 6 seconds, like the one you can confiure on this website: http://www.civicuk.com/cookie-law/index
But not sure how to write the full code.
azhar.rabi
Member
146 Points
26 Posts
Re: JQuery code...What am I missing
Jun 25, 2012 02:00 PM|LINK
This code runs when someone clicks on Argee button,
agree_button.onclick = function() { var expires = new Date(); expires.setFullYear(expires.getFullYear() + 5); document.cookie = "eu-opt-in=1" + "; path=/; expires=" + expires.toUTCString(); HI.optInCookies.showSplash(); if(HI.optInCookies.onAgree) HI.optInCookies.onAgree(); };You can use the above code to set agree and hide the control.
$(document).ready(function() { setTimeOut("AgreeAndHide();",6000) ; }); function AgreeAndHide(){ var expires = new Date(); expires.setFullYear(expires.getFullYear() + 5); document.cookie = "eu-opt-in=1" + "; path=/; expires=" + expires.toUTCString(); HI.optInCookies.showSplash(); if(HI.optInCookies.onAgree) HI.optInCookies.onAgree(); }