• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 Link to hide a notice?

#1
Hello,

I want to show a bigger Link to hide a notice, so I added the following HTML into the notice text:

HTML:
<a href="account/dismiss-notice?notice_id=1" class="callToAction"><span>OK</span></a>
But this does not work as a guest user. Do I need a special JavaScript action oder class too?
 

Russ

Well-known member
#3
You could actually use some simple CSS in extra.css along with a phrase change

Code:
#XenForo .DismissParent .DismissCtrl {
background: #000 none no-repeat scroll 0 0;
font-size: 12px;
font-weight: bold;
height: auto;
padding: 7px 20px;
text-indent: 0;
top: 7px;
width: auto;
}
#XenForo .Notices .panel .noticeContent {
padding-right: 62px;
}
Edit the phrase: "dismiss_notice"

Screenshot_6.png


(I only tested this on the default notices not the floating ones)
 

Russ

Well-known member
#7
Nice! :) But I don't want it global. Only one notice must have this bigger button.
Modify the CSS:

Code:
#XenForo .DismissParent.notice_2 .DismissCtrl
{
   background: #000 none no-repeat scroll 0 0;
   font-size: 12px;
   font-weight: bold;
   height: auto;
   opacity: 0.6;
   padding: 7px 20px;
   text-indent: 0;
   top: 7px;
   width: auto;
}
#XenForo .Notices .notice_2 .noticeContent
{
   padding-right: 62px;
}
change the _2 to your notice ID. You can still change the phrase as it doesn't show on any of the notices anways
 
#8
Finally I found a solution without extra CSS or modification.

Just add this HTML to a notice:

HTML:
<a class="callToAction" onclick="$(this).closest('.Notice').find('a.DismissCtrl').trigger('click');"><span>OK</span></a>
 

ActorMike

Active member
#9
I also removed the opacity to make the X more visible because users were not seeing it.

.DismissParent .DismissCtrl {
opacity: 100;
}