Css Hover Tooltip doesn't work in JqGrid - css

I have a css tooltip that I use to provide guidance, and I'm trying to include it in the jqgrid.
However, the title of the column appears on hover. The <span> does not. I tried adding title:false, but then nothing happens.
Here's the css I'm using:
.tooltip { border-bottom:1px dotted #000000; outline:none; text-decoration:none; cursor:help; }
.tooltip:hover em { padding: .2em 0 .6em 0; font-weight:bold; display:block; }
.tooltip { position:relative; }
.tooltip:hover span { position:absolute; left:1em; top:-4.5em; z-index:99; margin-left:0; width:150px; }
.tooltip:hover em { border:0; margin: -10px 0 0 -55px; float:left; position:absolute; }
.tooltip span { margin-left:-999em; position:absolute; }
And here's how it's applied:
<a class='tooltip' href='#'>
<img alt='Help' src='/Images/question_mark_sm.png' />
<span class='tooltip_classic info'>Guidance Tag</span>
</a>
Not sure why it will work anywhere else but in the jqGrid. I've tried and tried, but it doesn't seem to work. (Well, the image shows up and the cursor changes, but no popup.)

Try to remove tooltip attribute from a jqGrid cell.
For me it works fine for all the browsers, except IE7. I used jqGrig gridComplete event.
Here is an example:
// _YourColID is you column name from colModel
$("td[aria-describedby*=_YourColID]", "#yourGridID tr").removeAttr("title");
$("td[aria-describedby*=_YourColID]", "#yourGridID tr").tooltip({
// each trashcan image works as a trigger
tip: '.tooltip',
// custom positioning
position: 'center right',
// move tooltip a little bit to the right
offset: [0, -10],
// there is no delay when the mouse is moved away from the trigger
delay: 0,
predelay: 2000,
onShow: function(e){
if ($(e.target).parent("tr").attr('id') != -1) {
yourTooltipFunction($(e.target).parent("tr").attr("id"));
}
}
}).dynamic({
bottom: {
direction: 'down',
bounce: true
}
});

Related

Change header background colour when page scrolls on sticky header

i have a sticky transparent header using the following css code on my website www.obviagency.com
CSS CODE:
#site-header-inner {
height:0px;
z-index:170;
margin:0 auto;
width:100%;
position:fixed;
top:0;
margin-top:10px;
}
i would like to change the background color on scroll to white. can someone please help me because nothing i've tried works:/
thank you
You would have to use JavaScript with a scroll event listener. I used blue as an example so you can see the change and added a transition property to the header so it would transition smoothly.
let header = document.getElementById('site-header-inner');
document.addEventListener('scroll', function() {
// Get the scroll position
let scrollPos = window.pageYOffset;
if ( scrollPos > 100 ) {
header.style.backgroundColor = "white";
} else {
header.style.backgroundColor = "blue";
}
});
#site-header-inner {
height:50px;
z-index:170;
margin:0 auto;
width:100%;
position:fixed;
top:0;
margin-top:10px;
background-color: blue;
transition: all 0.3s;
}
#section {
height: 1000px;
}
<header id="site-header-inner">
</header>
<section id="section">
</section>

Custom style to jQuery UI dialogs

I am trying to change jQuery UI dialog's default styles to something similar to this -
I got it to close changing some CSS in jQuery UI.
.ui-widget {
font-family: Verdana,Arial,sans-serif;
font-size: .8em;
}
.ui-widget-content {
background: #F9F9F9;
border: 1px solid #90d93f;
color: #222222;
}
.ui-dialog {
left: 0;
outline: 0 none;
padding: 0 !important;
position: absolute;
top: 0;
}
#success {
padding: 0;
margin: 0;
}
.ui-dialog .ui-dialog-content {
background: none repeat scroll 0 0 transparent;
border: 0 none;
overflow: auto;
position: relative;
padding: 0 !important;
}
.ui-widget-header {
background: #b0de78;
border: 0;
color: #fff;
font-weight: normal;
}
.ui-dialog .ui-dialog-titlebar {
padding: 0.1em .5em;
position: relative;
font-size: 1em;
}
HTML :
<div id="popup-msg">
<div id="loading">
<h2>Loading...</h2>
<h3>Please wait a few seconds.</h3>
</div>
<div id="success" title="Hurray,">
<p>User table is updated.</p>
</div>
</div>
THIS IS FIDDLE
But when I add this style its apply to all my dialogs. Can anybody tell me how can I avoid from this problem.
Thank you.
See https://jsfiddle.net/qP8DY/24/
You can add a class (such as "success-dialog" in my example) to div#success, either directly in your HTML, or in your JavaScript by adding to the dialogClass option, as I've done.
$('#success').dialog({
height: 50,
width: 350,
modal: true,
resizable: true,
dialogClass: 'no-close success-dialog'
});
Then just add the success-dialog class to your CSS rules as appropriate. To indicate an element with two (or more) classes applied to it, just write them all together, with no spaces in between. For example:
.ui-dialog.success-dialog {
font-family: Verdana,Arial,sans-serif;
font-size: .8em;
}
You can specify a custom class to the top element of the dialog via the option dialogClass
$("#success").dialog({
...
dialogClass:"myClass",
...
});
Then you can target this class in CSS via .myClass.ui-dialog.
The solution only solves part of the problem, it may let you style the container and contents but doesn't let you change the titlebar. I developed a workaround of sorts but adding an id to the dialog div, then using jQuery .prev to change the style of the div which is the previous sibling of the dialog's div. This works because when jQueryUI creates the dialog, your original div becomes a sibling of the new container, but the title div is a the immediately previous sibling to your original div but neither the container not the title div has an id to simplify selecting the div.
HTML
<button id="dialog1" class="btn btn-danger">Warning</button>
<div title="Nothing here, really" id="nonmodal1">
Nothing here
</div>
You can use CSS to style the main section of the dialog but not the title
.custom-ui-widget-header-warning {
background: #EBCCCC;
font-size: 1em;
}
You need some JS to style the title
$(function() {
$("#nonmodal1").dialog({
minWidth: 400,
minHeight: 'auto',
autoOpen: false,
dialogClass: 'custom-ui-widget-header-warning',
position: {
my: 'center',
at: 'left'
}
});
$("#dialog1").click(function() {
if ($("#nonmodal1").dialog("isOpen") === true) {
$("#nonmodal1").dialog("close");
} else {
$("#nonmodal1").dialog("open").prev().css('background','#D9534F');
}
});
});
The example only shows simple styling (background) but you can make it as complex as you wish.
You can see it in action here:
https://codepen.io/chris-hore/pen/OVMPay

jquery pop up window trouble

i am using this jquery function to display a pop window. in this code it works fine for paragraph or div attribute with a css id. but i want to use it a several times in my html file, so i need to convert the id's to classes.
here is my js file:
//0 means disabled; 1 means enabled;
var popupStatus = 0;
//loading popup with jQuery magic!
function loadPopup(){
//loads popup only if it is disabled
if(popupStatus==0){
$("#backgroundPopup").css({
"opacity": "0.7"
});
$("#backgroundPopup").fadeIn("slow");
$("#popupContact").fadeIn("slow");
popupStatus = 1;
}
}
//disabling popup with jQuery magic!
function disablePopup(){
//disables popup only if it is enabled
if(popupStatus==1){
$("#backgroundPopup").fadeOut("slow");
$("#popupContact").fadeOut("slow");
popupStatus = 0;
}
}
//centering popup
function centerPopup(){
//request data for centering
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var popupHeight = $("#popupContact").height();
var popupWidth = $("#popupContact").width();
//centering
$("#popupContact").css({
"position": "absolute",
"top": windowHeight/2-popupHeight/3.25,
"left": windowWidth/2-popupWidth/2
});
//only need force for IE6
$("#backgroundPopup").css({
"height": windowHeight
});
}
//CONTROLLING EVENTS IN jQuery
$(document).ready(function(){
//LOADING POPUP
//Click the button event!
$("#button").click(function(){
//centering with css
centerPopup();
//load popup
loadPopup();
});
//CLOSING POPUP
//Click the x event!
$("#popupContactClose").click(function(){
disablePopup();
});
//Click out event!
$("#backgroundPopup").click(function(){
disablePopup();
});
//Press Escape event!
$(document).keypress(function(e){
if(e.keyCode==27 && popupStatus==1){
disablePopup();
}
});
});
here is the css:
#backgroundPopup{
display:none;
position:fixed;
_position:absolute; /* hack for internet explorer 6*/
height:100%;
width:100%;
top:0;
left:0;
background:#000000;
border:1px solid #cecece;
z-index:1;
}
#popupContact{
display:none;
position:fixed;
_position:absolute; /* hack for internet explorer 6*/
width:470px;
background:#FFFFFF;
border:2px solid #cecece;
z-index:2;
padding:12px;
font-size:13px;
}
#popupContact h1{
text-align:left;
color:#6FA5FD;
font-size:22px;
font-weight:700;
border-bottom:1px dotted #D3D3D3;
padding-bottom:2px;
margin-bottom:20px;
}
#popupContactClose{
font-size:14px;
line-height:14px;
right:6px;
top:4px;
position:absolute;
color:#6fa5fd;
font-weight:700;
display:block;
cursor: pointer;
}
#button{
text-align:left;
}
and here is html:
<div id="button"><input type="submit" value="submit" /></div>
<div id="popupContact">
<a id="popupContactClose">x</a>
<h1>Description</h1>
<p id="contactArea">
<?php echo $data['description'];?>
</p>
</div>
<div id="backgroundPopup"></div>
it works perfectly, when it is set for div with a css id.but now, if i change all those '#'s to '.'s to make the id's into classes, it doesn't work. how do make it work?
maybe you must clear your browsercache. If you change all # to . and all id to class it must work....for more informations click here
Changed to class from id's it's working fine for me

Is it possible to set fill and stroke colors and opacity on VML paths using CSS?

For example, I'd like to do something like the following:
.myRedPath {
fillcolor: red;
}
...
<v:path class="myRedPath" v="..."/>
to fill my paths with a red color. Is this possible with the color and opacity of the fill and stroke attributes for VML elements? If so, how?
As mentioned in other answers, you may use DHMTL behaviors to apply any style specified in your style sheet to your VML element as behaviors are supported from IE5 to IE9.
Start by creating a HTC file, eg: vmlcss.htc:
<PUBLIC:COMPONENT>
<PUBLIC:ATTACH EVENT="onpropertychange" ONEVENT="onpropertychange()" />
<PUBLIC:METHOD NAME="refresh" />
<SCRIPT LANGUAGE="JScript">
function onpropertychange()
{
if (event.propertyName == "className")
{
refresh();
}
}
function refresh()
{
// Set any VML attribute you may define in your stylesheet
element.fillcolor = element.currentStyle["fillcolor"];
element.strokecolor = element.currentStyle["strokecolor"];
// etc.
}
refresh();
</SCRIPT>
</PUBLIC:COMPONENT>
Then apply it to your VML elements. For your particular example, you would use:
<style>
v\:path
{
behavior: url(vmlcss.htc);
}
</style>
Finally, specify the styles as shown in your example:
.myRedPath
{
fillcolor: red;
strokecolor: yellow;
}
You may want to modify the behavior file to add support for all VML attributes.
One could use such a technique to write a library that draws shapes using VML or SVG (depending on the browser support) and allows styling through CSS. Support for SVG styles could then be added to the VML objects using such a behavior file by mapping each SVG style to the corresponding VML attributes.
In IE7, you can do following:
vml\:polyline
{
strokecolor: expression(this.strokecolor = "red");
fillcolor: expression(this.fillcolor = "green");
}
But it doesn't work in IE8+ Standards mode, so not really that much useful.
VML uses attributes instead of CSS properties, so the only way to reference them in a style sheet is to add another behavior URL which references a htc which sets attribute values. Otherwise, use a HTML element to wrap the VML element and add the background color to it:
<!doctype html>
<html xmlns:v xmlns:svg='http://www.w3.org/2000/svg'>
<head>
<meta charset="UTF-8">
<title>Lightbox Simple</title>
<style type="text/css">
/* Hide scrollbars */
/*html, body { overflow: hidden; }*/
/*modal input*/
.trigger { display:inline-block; }
/* Hide modal transparency */
.dialog, .film { position:absolute; left:-7777px; z-index:2; }
/* modal output */
a.trigger:hover .dialog { display: block; left:50%; top:50%; width:500px; border: 1px solid #fff; }
a.trigger:hover .film { left: -3333px; top:-3333px; width:7777px; height:7777px; opacity: .7; background-color: #000; z-index: 3;}
/* modal content */
.visible { display: inline-block; background-color: #999; position:absolute; width: 200px; z-index: 4;}
/* modal off switch */
.closer { z-index:4; position:absolute; top:0; right:20px; display:block; background-color: #fff; color: #fff; width:0; }
.placeholder { position:absolute; top:0; left:0; }
#media,
{
v\:rect,v\:fill { behavior:url(#default#VML);}
.vml_bg
{
position:absolute;
left:0;
top:0;
width:100%;
height:100%;
}
a.trigger:hover .film { width: 0; }
.vml_wrap {
position:absolute;
left:0;
top:0;
width:0;
height:0;
display:inline-block;
}
a.trigger:hover { visibility: visible; }
a.trigger:hover .vml_wrap{ width:7777px; height:7777px; }
}
</style>
</head>
<body>
<p>hey</p>
<span class="closer">X</span>
<a href="#" class="trigger">
you
<span class="vml_wrap"><v:rect fillcolor="black" class="vml_bg"><v:fill opacity="0.5" /></v:rect></span>
<span class="dialog">
<span class="visible">hi</span>
<span class="film">
</span>
</span>
</a>
</body>
</html>

z-index css Pop-up box and ie7

I have some div boxes which should show a speech box when on hover. With jQuery and CSS it’s nothing too hard.
However, the popup speech appears under the neighbor div in IE7 — I can not make it to appear under it (see the shots).
I tried to play with z-index at different spots with no success.
FF
alt text http://img134.imageshack.us/img134/5314/63386894.png
IE7
alt text http://img396.imageshack.us/img396/9329/95483890.png
HTML
<div class="boardshot_list">
{% for ... %}
<span class="img_box">
<a href="/site_media/xxx" target="_blank">
<img class="trigger" src="xxx" alt="{{ item.title }}" />
</a>
<div class="container_speech_box popup">
<div class="two">
<b class="tl"><b class="tr"></b></b>
<p>
blabla
</p>
<b class="bl"></b><b class="br"><b class="point"></b></b>
</div>
</div>
</span>
{% endfor %}
</div>
CSS
div.boardshot_list span.img_box {
display:block;
width:220px;
height:180px;
float: left;
margin: 0 10px 10px 0;
position: relative;
}
img.trigger{
border:1px solid #373743;
}
div.popup
{
display: none;
position: absolute;
z-index: 50;
}
/* POPUP rounded box */
.container_speech_box div:after {content: "."; display: block; height:11px; clear:both; visibility:hidden;}
.container_speech_box div {width:300px; height:auto; font-family:verdana; font-size:11px;}
b.tl {display:block; width:300px; height:8px; font-size:1px;}
b.tr {display:block; width:292px; height:8px; font-size:1px; float:right;}
b.bl {display:block; width:8px; height:8px; font-size:1px; float:left;}
b.br {display:block; width:292px; height:8px; font-size:1px; float:right; position:relative;}
b.point {display:block; font-size:1px; width:25px; height:14px;}
.container_speech_box div p {padding:8px; margin:0; border:3px solid #4f5b69; border-width:0 3px; text-align:justify;}
div.two b.tl {background:url(/site_media/images/top_left2.gif) top left no-repeat;}
div.two b.tr {background:url(/site_media/images/top_right2.gif) top right no-repeat;}
div.two p {background:#fff;}
div.two b.bl {background:url(/site_media/images/bottom_left2.gif) top left no-repeat;}
div.two b.br {background:url(/site_media/images/bottom_right2.gif) top right no-repeat;}
div.two b.point {background:url(/site_media/images/point2.gif) top left no-repeat; margin:5px 0 0 125px;}
/* end popup table */
div.boardshot_list {
width: 700px;
clear: left;
min-height: 80px;
}
div.boardshot_list .memo_id {
padding-left: 10px;
position: relative;
float:right;
color:#60564d;
font-size: 25px;
padding-top: 20px;
width: 50px;
top: 30px;
left: 10px;
font-family:"Palatino Linotype","Book Antiqua",Palatino,FreeSerif,serif;
}
div.boardshot_list.even {
background-color: #f3f5f6;
}
div.boardshot_list .title span{
color: #bbb;
font-weight: normal;
}
div.boardshot_list .img img {
border:1px solid #373743;
}
JS
<script type="text/javascript">
$(document).ready(function(){
$('.img_box').each(function () {
// options
var distance = 10;
var time = 250;
var hideDelay = 50;
var hideDelayTimer = null;
// tracker
var beingShown = false;
var shown = false;
var trigger = $('.trigger', this);
var popup = $('.popup', this).css('opacity', 0);
// set the mouseover and mouseout on both element
$([trigger.get(0), popup.get(0)]).mouseover(function () {
// stops the hide event if we move from the trigger to the popup element
if (hideDelayTimer) clearTimeout(hideDelayTimer);
// don't trigger the animation again if we're being shown, or already visible
if (beingShown || shown) {
return;
} else {
beingShown = true;
// reset position of popup box
popup.css({
top: -10,
left: 20,
display: 'block' // brings the popup back in to view
})
// (we're using chaining on the popup) now animate it's opacity and position
.animate({
top: '-=' + distance + 'px',
opacity: 0.9
}, time, 'swing', function() {
// once the animation is complete, set the tracker variables
beingShown = false;
shown = true;
});
}
}).mouseout(function () {
// reset the timer if we get fired again - avoids double animations
if (hideDelayTimer) clearTimeout(hideDelayTimer);
// store the timer so that it can be cleared in the mouseover if required
hideDelayTimer = setTimeout(function () {
hideDelayTimer = null;
popup.animate({
opacity: 0
}, time, 'swing', function () {
shown = false;
popup.css('display', 'none');
});
}, hideDelay);
});
});
});
</script>
I think this is due to a z-index bug in Internet Explorer. Positioned elements (i.e. elements with a position other than static) establish their own stacking context.
http://www.quirksmode.org/bugreports/archives/2006/01/Explorer_z_index_bug.html
In my experience, it’s as if all your div.boardshot_list span.img_box have a z-index of 0, and elements inside each div.boardshot_list span.img_box have a z-indexes of 0.1, 0.2 and so on, instead of 1 and 2.
You should be able to fix the issue by setting the z-index of the span.img_box containing the visible pop-up to 1, like this:
// reset position of popup box
popup.css({
top: -10,
left: 20,
display: 'block' // brings the popup back in to view
})
$(this).css('z-index', '1');
Don’t forget to reset it to 0 when the pop-up disappears.
It's probably because of conflict of multiply classes (.container_speech_box and .popup) style resolution in different browsers. Try to wrap .popup div around the .container_speech_box.

Resources