workaround for chrome notifications manifest 3 - google-chrome

I want to display the notifications using manifest 3, Is there a workaround thats possible than waiting for chrome 91?
As a fix I used data URI, but that doesnt work
chrome.notifications.create(
"1", {
iconUrl: "data:image/png;base64,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",
title: "This should be a notification",
type: "basic",
message: "Notification body",
isClickable: true,
priority: 2,
},
function () { }
);

You could create a tiny library that do some similar to chrome.notification.
I had done something similar for progress notifications which Firefox (did|do) not support.
I hope this code inspires you.
However, I suggest you wait for MV3 to be a little more "mature"
JS:
function myNotif(id, title, body, zIdx, evnt) {
let divL1 = document.createElement("div");
divL1.id = 'myNotif_' + id;
divL1.className = 'myNotifClass';
//X per chiudere
let divL2 = document.createElement("div");
divL2.className = 'myNotifClass_X';
divL2.innerHTML = '<SVG WIDTH="10" HEIGHT="10" viewBox="0 0 20 20"><path stroke-width="3" stroke="black" class="checkmark__check" fill="none" d="M0 0 20 20 M20 0 0 20" /></SVG>';
if (evnt) {
if (evnt._onClose)
divL2.addEventListener('click', function() { evnt._onClose(); document.body.removeChild(this.parentNode) })
else
divL2.addEventListener('click', function() { document.body.removeChild(this.parentNode) })
}
divL1.appendChild(divL2);
//TITOLO
divL2 = document.createElement("div");
divL2.className = 'myNotifClass_title';
divL2.textContent = title;
divL1.appendChild(divL2);
//img & body
divL2 = document.createElement("div");
divL2.className = 'myNotifClass_img_body';
//img
let divL3 = document.createElement("div");
divL3.className = 'myNotifClass_img';
divL2.appendChild(divL3);
//body
divL3 = document.createElement("div");
divL3.className = 'myNotifClass_body';
let divL4 = document.createElement("div");
divL4.className = 'myNotifClass_bodyUp';
let divL5 = document.createElement("div");
divL5.id = 'myNotif_' + id + '_bodyUp_CT';
divL5.className = 'myNotifClass_bodyUp_CT';
divL5.innerHTML = body;
divL4.appendChild(divL5);
divL3.appendChild(divL4);
divL4 = document.createElement("div");
divL4.className = 'myNotifClass_bodyDown';
divL5 = document.createElement("progress");
divL5.id = 'myNotif_' + id + '_Progress';
divL5.value = 0;
divL5.max = 100;
divL4.appendChild(divL5);
divL3.appendChild(divL4);
divL2.appendChild(divL3);
divL1.appendChild(divL2);
divL1.style.zIndex = zIdx;
if (evnt)
if (evnt._onClick)
divL2.addEventListener('click', function() { evnt._onClick() });
document.body.appendChild(divL1)
}
CSS:
progress {
margin:3px 4px;
width:230px;
height:6px;
border-radius:2px
}
progress::-moz-progress-bar {
background-color:#1e90ff;
border-radius:2px
}
.myNotifClass {
font-family:Verdana, Calibri;
position:fixed;
bottom:8px;
right:9px;
width:351px;
height:115px;
background-color:white;
border:1px solid gray;
box-shadow:1px 1px darkgray;
color:black;
}
.myNotifClass .myNotifClass_X {
position:relative;
float:right;
top:5px;
right:8px
}
.myNotifClass .myNotifClass_title {
font-size:12px;
font-weight:bold;
position:relative;
top:7px;
left:8px;
width:316px;
height:14px;
background-color:inherit;
border:0px;
padding:2px;
overflow:hidden
}
.myNotifClass .myNotifClass_img_body {
font-size:12px;
position:relative;
left:8px;
top:7px;
bottom:8px;
width:320px;
height:80px;
background-color:inherit;
border:0px;
padding:0px
}
.myNotifClass .myNotifClass_img_body .myNotifClass_img {
position:inherit;
float:left;
left:0px;
top:0px;
height:100%;
width:80px;
background-image:url('./wait.png');
background-position:center;
background-size:auto;
background-repeat:no-repeat;
background-color:inherit;
margin:0
}
.myNotifClass .myNotifClass_img_body .myNotifClass_body {
position:inherit;
float:right;
right:0px;
height:100%;
width:240px;
background-color:inherit;
margin:0
}
.myNotifClass .myNotifClass_img_body .myNotifClass_body .myNotifClass_bodyUp{
font-size:11px;
height:53px;
line-height:130%;
width: 236px; /*calc(100%-4px);*/
background-color:inherit;
padding:5px 2px 5px 2px;
overflow:hidden;
display:table
}
.myNotifClass .myNotifClass_img_body .myNotifClass_body .myNotifClass_bodyUp .myNotifClass_bodyUp_CT {
display:table-cell;
height:100%;
vertical-align:middle
}
.myNotifClass .myNotifClass_img_body .myNotifClass_body .myNotifClass_bodyDown{
height:17px;
width:100%;
background-color:inherit
}
HTML:
<HTML>
<HEAD>
<LINK TYPE="text/css" REL="stylesheet" HREF="./provaNotifDIV.css">
<SCRIPT SRC="./provaNotifDIV.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
function startProgress() {
var timer = setInterval( function() {
let x = document.getElementById('myNotif_1_Progress');
if (x.value >= 100) {
clearTimeout(timer);
document.getElementById('myNotif_1_bodyUp_CT').textContent = "FATTO!"
}
else {
x.value += 1;
document.getElementById('num').textContent = x.value
}
}, 12)
}
document.addEventListener('DOMContentLoaded', function() {
myNotif(1, 'Trasferimento Indicatori in corso...', '<SPAN ID="num">0</SPAN> su <SPAN ID="denom">100</SPAN> caricati', 100, {'_onClick': function() { alert('click') }, '_onClose': function() {alert('close')} });
startProgress()
})
</SCRIPT>
</HEAD>
<BODY>
Ciao
</BODY>
</HTML>

Related

html cannot click link in div

this is my code , i put the link below :
LINK
this output for this source below :
i have link but it's not function when on click , i put that in div notification you can check full of source below , maybe the problem is in the css configure , but i cant figure out of my problem , can you fix it ?
<html>
<head>
<title>Create a Facebook like Notifications Window using jQuery and CSS</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<style>
ul {
display:block;
/*background:#45619D;*/
list-style:none;
margin:0;
margin-left:500px;
padding:12px 10px;
height:21px;
width : 45px;
}
ul li {
float:left;
font:13px helvetica;
font-weight:bold;
margin:3px 0;
}
#noti_Container {
position:relative;
}
/* A CIRCLE LIKE BUTTON IN THE TOP MENU. */
#noti_Button { /*pengaturan lingkaran*/
width:22px;
height:22px;
line-height:22px;
border-radius:50%;
-moz-border-radius:50%;
-webkit-border-radius:50%;
background:red;
margin:-3px 10px 0 10px;
cursor:pointer;
}
#noti_buttons{
cursor:pointer;
}
/* THE POPULAR RED NOTIFICATIONS COUNTER. */
#noti_Counter { /*pengaturan hitung jumlah notif yang ada*/
display:block;
position:absolute;
background:#E1141E;
color:#FFF;
font-size:12px;
font-weight:normal;
padding:1px 3px;
margin:-8px 0 0 25px;
border-radius:2px;
-moz-border-radius:2px;
-webkit-border-radius:2px;
z-index:1;
}
/* THE NOTIFICAIONS WINDOW. THIS REMAINS HIDDEN WHEN THE PAGE LOADS. */
#notifications { /*pengaturan kotak notification*/
display:none;
width:400px;
position:absolute;
top:42px;
left:-350px;
background:#FFF;
border:solid 1px rgba(100, 100, 100, .20);
-webkit-box-shadow:0 3px 8px rgba(0, 0, 0, .20);
z-index: 1;
}
/* AN ARROW LIKE STRUCTURE JUST OVER THE NOTIFICATIONS WINDOW */
#notifications:before { /*pengaturan warna arrow*/
content: '';
display:block;
width:0;
height:0;
color:transparent;
border:10px solid #CCC;
border-color:transparent transparent #e8e8e8;
margin-top:-20px;
margin-left:355px;
}
h3 {
display:block;
color:#333;
background:#FFF;
font-weight:bold;
font-size:13px;
padding:8px;
margin:0;
border-bottom:solid 1px rgba(100, 100, 100, .30);
}
.seeAll {
background:#F6F7F8;
padding:8px;
font-size:12px;
font-weight:bold;
border-top:solid 1px rgba(100, 100, 100, .30);
text-align:center;
}
.seeAll a {
color:#3b5998;
}
.seeAll a:hover {
background:#F6F7F8;
color:#3b5998;
text-decoration:underline;
}
</style>
</head>
<body style="margin:0;padding:0;">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<ul>
<li id="noti_Container">
<div id="noti_Counter"></div> <!--SHOW NOTIFICATIONS COUNT.-->
<!--A CIRCLE LIKE BUTTON TO DISPLAY NOTIFICATION DROPDOWN.-->
<!--<div id="noti_Button"></div>-->
<img id="noti_Buttons" src="bell.png"></img>
<!--THE NOTIFICAIONS DROPDOWN BOX.-->
<div id="notifications">
LINK
<h3>Notifications</h3>
<?php
$user_name = "root";
$password = "";
$database = "wordpress";
$host_name = "localhost";
$koneksi = mysqli_connect($host_name, $user_name, $password , $database);
$result = mysqli_query($koneksi,"SELECT wp_comments.comment_content,wp_posts.post_name FROM wp_comments INNER JOIN
wp_posts ON wp_comments.comment_post_id = wp_posts.id AND wp_comments.user_id = 3 AND wp_comments.comment_approved = 1");
while($row = mysqli_fetch_array($result,MYSQLI_ASSOC)){ ?>
<div style="padding:20px 0px 20px 0px;border-bottom:solid 1px #e8e8e8">
<div style="padding-left:10px;">
<?php
echo "your comment has been approved </br>".$row['comment_content'];?><a style="position:absolute;z-index:1" href="www.google.com" target="_top">see more link</a></br>
</div>
</div>
<?php } ?>
<div class="seeAll">See All</div>
</div>
</li>
</ul>
</body>
<script>
$(document).ready(function () {
// ANIMATEDLY DISPLAY THE NOTIFICATION COUNTER.
$('#noti_Counter')
.css({ opacity: 0 })
.text('7') // ADD DYNAMIC VALUE (YOU CAN EXTRACT DATA FROM DATABASE OR XML).
.css({ top: '-10px' })
.animate({ top: '-2px', opacity: 1 }, 500);
$('#noti_Buttons').click(function () {
// TOGGLE (SHOW OR HIDE) NOTIFICATION WINDOW.
$('#notifications').fadeToggle('fast', 'linear', function () {
if ($('#notifications').is(':hidden')) {
}
// CHANGE BACKGROUND COLOR OF THE BUTTON.
else $('#noti_Buttons').css('filter', 'opacity(70%)');
});
$('#noti_Counter').fadeOut('slow'); // HIDE THE COUNTER.
return false;
});
// HIDE NOTIFICATIONS WHEN CLICKED ANYWHERE ON THE PAGE.
$(document).click(function () {
$('#notifications').hide();
// CHECK IF NOTIFICATION COUNTER IS HIDDEN.
if ($('#noti_Counter').is(':hidden')) {
// CHANGE BACKGROUND COLOR OF THE BUTTON.
$('#noti_Buttons').css('filter', 'opacity(100%)');
}
});
$('#notifications').click(function () {
return false; // DO NOTHING WHEN CONTAINER IS CLICKED.
});
$("img").hover(function(){
$(this).css("filter", "opacity(30%)");
}, function(){
$(this).css("filter", "opacity(100%)");
});
});
</script>
</html>
Try to add HTTPS or HTTP in the href attribute.
LINK
Try this in the div, "notifications".
Thank you

samsung smart tv sdk 4.1 application not working on sdk 5.1

I have made an application on Samsung Smart TV SDK 4.1, but that application is not working on Samsung Smart TV SDK 5.1.
Can any one help me with remote working in sdk 5.1
I have tried some demo apps from samsungdforum but its not helping me.
Code:
The code is:
Main.js
var widgetAPI = new Common.API.Widget();
var tvKey = new Common.API.TVKeyValue();
var current_selected_index=0;
var menu_count=5;
var Main =
{
};
Main.onLoad = function()
{
// Enable key event processing
this.enableKeys();
widgetAPI.sendReadyEvent();
};
Main.onUnload = function()
{
};
Main.enableKeys = function()
{
document.getElementById("menu").focus();
$('.menu').eq(current_selected_index).addClass('selected');
$('.menu a').eq(current_selected_index).focus();
};
Main.keyDown = function()
{
var keyCode = event.keyCode;
alert("Key pressed: " + keyCode);
switch(keyCode)
{
case tvKey.KEY_UP:
alert("UP");
$('.menu').eq(current_selected_index).removeClass("selected");
if(current_selected_index==0){
current_selected_index=3;
}
else{
current_selected_index--;
}
$('.menu').eq(current_selected_index).addClass("selected");
break;
case tvKey.KEY_DOWN:
alert("DOWN");
$('.menu').eq(current_selected_index).removeClass("selected");
if(current_selected_index==3){
current_selected_index=0;
}
else{
current_selected_index--;
}
$('.menu').eq(current_selected_index).addClass("selected");
break;
case tvKey.KEY_LEFT:
alert("LEFT");
$('.menu').eq(current_selected_index).removeClass("selected");
if(current_selected_index==0){
current_selected_index=4;
}
else{
current_selected_index--;
}
$('.menu').eq(current_selected_index).addClass("selected");
$('.menu a').eq(current_selected_index).focus();
break;
case tvKey.KEY_RIGHT:
alert("RIGHT");
$('.menu').eq(current_selected_index).removeClass("selected");
if(current_selected_index==4){
current_selected_index=0;
}
else{
current_selected_index++;
}
$('.menu').eq(current_selected_index).addClass("selected");
$('.menu a').eq(current_selected_index).focus();
break;
case tvKey.KEY_ENTER:
var $j;
$('#display').html($('.menu a').eq(current_selected_index).html());
$j=$('.menu a').eq(current_selected_index).html();
window.location=$j+".html";
alert($(this).html());
break;
case tvKey.KEY_PANEL_ENTER:
$('#display').html($('.menu a').eq(current_selected_index).html());
alert($(this).html());
break;
default:
alert("Unhandled key");
break;
}
};
Main.mouseclick=function()
{
$('#display').html($('.menu a').eq(current_selected_index).html());
window.location="hyderabad.html";
};
**Main.css**
*
{
padding: 0;
margin: 0;
border: 0;
}
body
{
width: 960px;
height: 540px;
}
#container
{
width:800px;
height:400px;
position:absolute;
left:50%;
margin-left:-250px;
top:50%;
margin-top:-150px;
border:1pxsolid#fff;
border-radius:5px;
}
.retunbtn
{
position:absolute;
left:80%;
margin-left:-150px;
top:80%;
margin-top:-180px;
border:1pxsolid#fff;
border-radius:5px;
}
.menu
{
float:left;
width:100px;
height:100px;
margin-top:20px;
margin-left:20px;
text-align:center;
line-height:6em;
background-image: -webkit-linear-gradient(bottom,rgb(135,135,135) 7%, rgb(184,184,184) 54%);
border-radius:5px;
}
.menu a{
color:#8B0000;
text-decoration:none;
text-transform:uppercase;
}
#display{
clear:both;
width:400px;
height:100px;
margin-left:50px;
position:absolute;
bottom:50px;
border:1pxsolid#fff;
border-radius:5px;
text-align:center;
color:blue;
font-weight:bold;
line-weight:3em;
}
.selected
{
background-image:-webkit-linear-gradient(bottom,rgb(135,135,135)7%,rgb(184,184,184)54%);
color:black;
}
#content{
color:#800000;
font:bold;
align-text:center;
position:absolute;
left:50%;
margin-left:-250px;
top:30%;
margin-top:-150px;
}
.menu1 {
float:left;
width:20%;
height:100%;
}
.mainContent {
float:left;
width:80%;
height:100%;
}
a:link, a:visited {
color: (internal value);
text-decoration: underline;
cursor: auto;
}
a:link:active, a:visited:active {
color: (internal value);
}
**index.html**
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>tourism</title>
<script type="text/javascript" src="app/javascript/jquery-1.9.1.js"></script>
<!-- TODO : Common API -->
<script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/API/Widget.js"></script>
<script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/API/TVKeyValue.js"></script>
<!-- TODO : Javascript code -->
<script language="javascript" type="text/javascript" src="app/javascript/Main.js"></script>
<!-- TODO : Style sheets code -->
<link rel="stylesheet" href="app/stylesheets/Main.css" type="text/css">
<!-- TODO: Plugins -->
</head>
<body onload="Main.onLoad();" onunload="Main.onUnload();">
<!-- Dummy anchor as focus for key events -->
<div id="content">
<h1>INDIA TOURISM APPLICATION</h1>
</div>
<div id="container">
<div class="menu">
<a href="javascript.void(0);" onkeydown="Main.keyDown();" >HYDERABAD</a>
</div>
<div class="menu">
Delhi
</div>
<div class="menu">
Jaipur
</div>
<div class="menu">
Jaipurs
</div>
<div class="menu">
Jaipur1
</div>
</div>
enter code here
<img src="images/wallpaper.jpg" style="width:960px;height:540px" >
<!-- TODO: your code here -->
</body>
</html>
first of all in main.enableKeys function you have to enable the keycodes.
var pluginAPI = new Common.API.Plugin();
> pluginAPI.registKey(tvKey.KEY_RETURN);
> pluginAPI.registKey(tvKey.KEY_EXIT);
than try to run application through remote.
The code is:
**Main.js**
var widgetAPI = new Common.API.Widget();
var tvKey = new Common.API.TVKeyValue();
var current_selected_index=0;
var menu_count=5;
var Main =
{
};
Main.onLoad = function()
{
// Enable key event processing
this.enableKeys();
widgetAPI.sendReadyEvent();
};
Main.onUnload = function()
{
};
Main.enableKeys = function()
{
document.getElementById("menu").focus();
$('.menu').eq(current_selected_index).addClass('selected');
$('.menu a').eq(current_selected_index).focus();
};
Main.keyDown = function()
{
var keyCode = event.keyCode;
alert("Key pressed: " + keyCode);
switch(keyCode)
{
case tvKey.KEY_UP:
alert("UP");
$('.menu').eq(current_selected_index).removeClass("selected");
if(current_selected_index==0){
current_selected_index=3;
}
else{
current_selected_index--;
}
$('.menu').eq(current_selected_index).addClass("selected");
break;
case tvKey.KEY_DOWN:
alert("DOWN");
$('.menu').eq(current_selected_index).removeClass("selected");
if(current_selected_index==3){
current_selected_index=0;
}
else{
current_selected_index--;
}
$('.menu').eq(current_selected_index).addClass("selected");
break;
case tvKey.KEY_LEFT:
alert("LEFT");
$('.menu').eq(current_selected_index).removeClass("selected");
if(current_selected_index==0){
current_selected_index=4;
}
else{
current_selected_index--;
}
$('.menu').eq(current_selected_index).addClass("selected");
$('.menu a').eq(current_selected_index).focus();
break;
case tvKey.KEY_RIGHT:
alert("RIGHT");
$('.menu').eq(current_selected_index).removeClass("selected");
if(current_selected_index==4){
current_selected_index=0;
}
else{
current_selected_index++;
}
$('.menu').eq(current_selected_index).addClass("selected");
$('.menu a').eq(current_selected_index).focus();
break;
case tvKey.KEY_ENTER:
var $j;
$('#display').html($('.menu a').eq(current_selected_index).html());
$j=$('.menu a').eq(current_selected_index).html();
window.location=$j+".html";
alert($(this).html());
break;
case tvKey.KEY_PANEL_ENTER:
$('#display').html($('.menu a').eq(current_selected_index).html());
alert($(this).html());
break;
default:
alert("Unhandled key");
break;
}
};
Main.mouseclick=function()
{
$('#display').html($('.menu a').eq(current_selected_index).html());
window.location="hyderabad.html";
};
**Main.css**
*
{
padding: 0;
margin: 0;
border: 0;
}
body
{
width: 960px;
height: 540px;
}
#container
{
width:800px;
height:400px;
position:absolute;
left:50%;
margin-left:-250px;
top:50%;
margin-top:-150px;
border:1pxsolid#fff;
border-radius:5px;
}
.retunbtn
{
position:absolute;
left:80%;
margin-left:-150px;
top:80%;
margin-top:-180px;
border:1pxsolid#fff;
border-radius:5px;
}
.menu
{
float:left;
width:100px;
height:100px;
margin-top:20px;
margin-left:20px;
text-align:center;
line-height:6em;
background-image: -webkit-linear-gradient(bottom,rgb(135,135,135) 7%, rgb(184,184,184) 54%);
border-radius:5px;
}
.menu a{
color:#8B0000;
text-decoration:none;
text-transform:uppercase;
}
#display{
clear:both;
width:400px;
height:100px;
margin-left:50px;
position:absolute;
bottom:50px;
border:1pxsolid#fff;
border-radius:5px;
text-align:center;
color:blue;
font-weight:bold;
line-weight:3em;
}
.selected
{
background-image:-webkit-linear-gradient(bottom,rgb(135,135,135)7%,rgb(184,184,184)54%);
color:black;
}
#content{
color:#800000;
font:bold;
align-text:center;
position:absolute;
left:50%;
margin-left:-250px;
top:30%;
margin-top:-150px;
}
.menu1 {
float:left;
width:20%;
height:100%;
}
.mainContent {
float:left;
width:80%;
height:100%;
}
a:link, a:visited {
color: (internal value);
text-decoration: underline;
cursor: auto;
}
a:link:active, a:visited:active {
color: (internal value);
}
**index.html**
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>tourism</title>
<script type="text/javascript" src="app/javascript/jquery-1.9.1.js"></script>
<!-- TODO : Common API -->
<script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/API/Widget.js"></script>
<script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/API/TVKeyValue.js"></script>
<!-- TODO : Javascript code -->
<script language="javascript" type="text/javascript" src="app/javascript/Main.js"></script>
<!-- TODO : Style sheets code -->
<link rel="stylesheet" href="app/stylesheets/Main.css" type="text/css">
<!-- TODO: Plugins -->
</head>
<body onload="Main.onLoad();" onunload="Main.onUnload();">
<!-- Dummy anchor as focus for key events -->
<div id="content">
<h1>INDIA TOURISM APPLICATION</h1>
</div>
<div id="container">
<div class="menu">
<a href="javascript.void(0);" onkeydown="Main.keyDown();" >HYDERABAD</a>
</div>
<div class="menu">
Delhi
</div>
<div class="menu">
Jaipur
</div>
<div class="menu">
Jaipurs
</div>
<div class="menu">
Jaipur1
</div>
</div>
enter code here
<img src="images/wallpaper.jpg" style="width:960px;height:540px" >
<!-- TODO: your code here -->
</body>
</html>

Panel division and white marker around markers in MapBox

Does anyone have MapBox experience?
I'm trying to implement a personal map with specific markers, complete with pan and zoom features. I was trying to implement the code from the website that does just this that comes directly from the MapBox website. However, when I implemented in to my own page I got the following:
As you can see there is a weird paneling effect happening as well as white blocks around the markers. The map is pretty ineffective this way so I was hoping someone out there knew the solution.
Here's the code I used:
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Pan and vertical zoom</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v1.6.4/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v1.6.4/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; height:500px}
</style>
</head>
<body>
<style>
.ui-control {
font:bold 12px/28px Helvetica, sans-serif;
text-align:center;
position:absolute;
top:10px;
left:10px;
z-index:1000;
}
.ui-pan {
position:absolute;
top:0;
left:0;
z-index:1000;
}
.ui-pan .panner {
background:#fff;
color:#404040;
font-size:9px;
position:absolute;
top:0;
left:0;
width:28px;
height:28px;
border:1px solid rgba(0,0,0,0.4);
border-radius:3px;
}
.ui-pan .panner:hover { background-color:#f8f8f8; color:#404040; }
.ui-pan .panner.up { left:28px; }
.ui-pan .panner.right { left:58px; top:28px; }
.ui-pan .panner.down { left:28px; top:58px; }
.ui-pan .panner.left { top:28px; }
.ui-zoombar {
background:#FFF;
position:relative;
top:93px;
left:28px;
width:28px;
height:200px;
border:1px solid rgba(0,0,0,0.4);
border-radius:3px;
cursor:pointer;
}
.ui-zoombar:hover { background-color:#f8f8f8; }
.ui-zoombar .handle {
position:absolute;
cursor:pointer;
width:26px;
height:28px;
background:#404040;
color:#fff;
border-radius:2px;
}
.ui-zoombar .handle:hover { background:#303030; }
</style>
<div class='ui-control'>
<div id='pan' class='ui-pan'>
<a href='#' id='up' class='panner up'>▲</a>
<a href='#' id='right' class='panner right'>▶</a>
<a href='#' id='down' class='panner down'>▼</a>
<a href='#' id='left' class='panner left'>◀</a>
</div>
<div id='zoom-bar' class='ui-zoombar dragdealer'>
<div id='handle' class='handle'>0</div>
</div>
</div>
<div id='map'> </div>
<!-- If you plan to use this example, download dragdealer from
https://code.google.com/p/dragdealer/ instead of hotlinking it like this -->
<script src='https://dragdealer.googlecode.com/svn/tags/0.9.5/dragdealer.js'></script>
<script>
var zooms = 19;
var handle = document.getElementById('handle');
var map = L.mapbox.map('map', 'tlchang.ikgi2358', {
zoomControl: false
})
.setView([42.0, -3.5], 2);
// Configure Dragdealer to update the map zoom
var zoom_bar = new Dragdealer('zoom-bar', {
steps: zooms,
snap: true,
horizontal: false,
vertical: true,
callback: function(x, y) {
var z = y * (zooms - 1);
map.setZoom(z);
handle.innerHTML = z;
}
});
// Round the zoom value the number looks presentable.
map.on('zoomend', function() {
var z = Math.round(map.getZoom());
zoom_bar.setValue(0, z / 19);
handle.innerHTML = z;
});
document.getElementById('left').onclick = function(e) { e.preventDefault(); map.panBy([-100, 0]); };
document.getElementById('right').onclick = function(e) { e.preventDefault(); map.panBy([100, 0]); };
document.getElementById('down').onclick = function(e) { e.preventDefault(); map.panBy([0, 100]); };
document.getElementById('up').onclick = function(e) { e.preventDefault(); map.panBy([0, -100]); };
</script>
</body>
</html>
Any ideas?!
This example works fine on its own.
However, when I implemented in to my own page I got the following:
This is probably the issue. If you can provide a link to your own page, then that would help - you probably have some over-eager CSS rules that are causing this problem.

Firefox no transition when fading back in an image

I made a nice transition effect when switching between images, it sets the opacity to 0 (With a transition of all .5s) then .5s later (Via setTimeout) the src of the image is changed and it should fade back in.
It works fine on Chrome and IE but on firefox the image fades out and then instead of fading back to opacity:1 it just jumps straight to it.
Here is my code
Javascript:
AddEventListener(window, 'load', function () {
window.FadeinTime = 500;
var LargeImageDiv = document.getElementById('LargeImage');
window.LargeImage = LargeImageDiv.childNodes[1];
var LargeImageCaption = LargeImageDiv.childNodes[3];
var SlideText = ['Videography', 'Photography', 'Walkthroughs', 'Fine Art'];
window.Images = []; //Some image links
LargeImage.src = '/Resources/Home/' + window.Images[0];
window.AutoSlide = setInterval(function () {
var SlideNo = parseInt(LargeImage.getAttribute('data-slide')) + 1;
var SlideTextNo = parseInt(LargeImage.getAttribute('data-slideText')) + 1;
if (SlideNo == Images.length) SlideNo = 0;
if (SlideTextNo == SlideText.length) SlideTextNo = 0;
LargeImage.setAttribute('data-slide', SlideNo.toString());
LargeImage.setAttribute('data-slideText', SlideTextNo.toString());
LargeImageDiv.setAttribute('style', '-khtml-opacity:0;-moz-opacity:0;-ms-filter: alpha(opacity=0);-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);filter: alpha(opacity=0);opacity:0;');
setTimeout(function () {
LargeImage.src = '/Resources/Home/' + Images[SlideNo];
LargeImageCaption.innerHTML = SlideText[SlideTextNo];
LargeImageDiv.removeAttribute('style');
}, window.FadeinTime)
}, 2500)
});
HTML:
<div id="LargeImage" class='NoSelect' onclick='if(event.target.nodeName == "BUTTON") return; var u = this.childNodes[3].innerHTML; window.location=(u=="Videography"||u=="Walkthroughs"?"/Videos/View/"+u:"/Pictures/View/"+u);'>
<img src="" data-slide='0' data-slideText='0'/>
<pre class='Caption'>Videography</pre>
</div>
CSS:
body > div#Content > div#LargeImage {
cursor:pointer;
max-height:490px;
min-height:300px;
width:100%;
overflow:hidden;
margin:0 auto;
position:relative;
-moz-transition:.5s;
-webkit-transition:.5s;
-o-transition:.5s;
transition:.5s;
}
body > div#Content > div#LargeImage > button {
position:absolute;
bottom:5px;
right:5px;
;
}
body > div#Content > div#LargeImage > img {
width:100%;
margin-top:-10%;
}
body > div#Content > div#LargeImage > pre {
height:50px;
font-size:80px;
}

Trouble with Div Hide/Show on mouse click

I tried your script but it isn't working right. I have edited my code below to show exactly what I am working with. Thank you so much for being helpful.
Quazi
Hi,
I am very new to JQuery.
I am trying to get a div to fade in after a click event and then hide after click anywhere. I have three divs set up to do this with css set as display:none. The problem is that the script does not work in IE8 and only works in ff/safari if I double click or triple click the menubar links below.
I am using the following code to show/hide these divs on mouse click:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
body,
html {
margin:0;
padding:0;
color:black;
background:black;
color:black;
}
#logo {
margin-top:1%;
width:12%;
margin-left:5%;
padding:1%;
border:2px solid #FF8c00;
}
#showsbanner {
margin-top:1%;
width:60%;
position:absolute;
right:2px;
}
#wrap {
width:90%;
margin:0 auto;
background:black;
color:black;
}
#header {
padding:5px 10px;
background:black;
color:#ef9c00;
}
h1 {
color:#35002c;
font-family:"verdana";
font-size:25px;
}
h2 {
color:#044476;
font-family:"verdana";
font-size:18px;
}
h3 {
color:#044476;
font-family:"verdana";
font-size:15px;
}
#nav {
padding:5px 10px;
width:89%;
margin-left:5%;
background:#ff8c00;
border:2px solid darkblue;
}
#nav ul {
margin:0;
padding:0;
list-style:none;
}
#nav li {
display:inline;
margin:0;
padding:0;
color:white;
}
#menubar {
float:left;
width:40%;
padding:1%;
background:#ff8c00;
margin-bottom:1%;
border:2px solid darkblue;
}
#bcity {
float:right;
width:50%;
padding:1%;
background:#ff8c00;
margin-bottom:1%;
border:2px solid darkblue;
}
#aicbk {
display:none;
float:right;
width:50%;
padding:1%;
background:#ff8c00;
margin-bottom:1%;
border:2px solid darkblue;
}
#pdil{
display:none;
float:right;
width:50%;
padding:1%;
background:#ff8c00;
margin-bottom:1%;
border:2px solid darkblue;
}
#footer {
clear:both;
padding:1px, 1px;
background:#ff8c00;
width:100%;
border:2px solid darkblue;
}
#footer p {
color:white;
font-size:12px
}
* html #footer {
height:1px;
}
//The last four lines are an IE bug fix
</style>
<script type="text/javascript" src="homepage_files/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var gLastH = null;
var gLastId = null;
$('.toggleh').hide();
$('.toggle').click(function(e) {
$('.toggleh:visible').fadeOut('slow');
gLastId = $(this).attr('id');
console.log('#' + gLastId + 'h');
gLastH = $('#' + gLastId + 'h');
$(gLastH).fadeIn('slow');
e.stopPropagation();
});
$('*').click(function(e) {
if ($(this).attr('id') != gLastId) {
$(gLastH).fadeOut('slow');
}
e.stopPropagation();
});
});
</script>
stuff...
text here
text here2
text here3
stuff......
<div class="toggleh" id="toggle2h">
<div id="aicbk">
stuff....
</div>
</div>
<div class="toggleh" id="toggle3h">
<div id="pdil">
stuff..
</div>
</div>
<div id="footer">
stuff..
</div>
Here's a working sample, tested under Chrome 8.0.552.0 dev:
<html>
<head>
<title>S.O. 3920865</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var gLastH = null;
var gLastId = null;
$('.toggleh').hide();
$('.toggle').click(function(e) {
$('.toggleh:visible').fadeOut('slow');
gLastId = $(this).attr('id');
console.log('#' + gLastId + 'h');
gLastH = $('#' + gLastId + 'h');
$(gLastH).fadeIn('slow');
e.stopPropagation();
});
$('*').click(function(e) {
if ($(this).attr('id') != gLastId) {
$(gLastH).fadeOut('slow');
}
e.stopPropagation();
});
});
</script>
</head>
<body>
<div id="menubar">
<div class="toggle" id="toggle1">
text here
</div>
<div class="toggleh" id="toggle1h">
some description in here I suppose
</div>
<div class="toggle" id="toggle2">
text here2
</div>
<div class="toggleh" id="toggle2h">
some description in here I suppose 2
</div>
<div class="toggle" id="toggle3">
text here3
</div>
<div class="toggleh" id="toggle3h">
some description in here I suppose 3
</div>
</div>
</body>
</html>
Perhaps you need to check jQuery UI accordion which can be what you really want.
EDIT: following 1st comment.
Use this simple code to hide/show menu (or any div)
<script type="text/javascript">
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'block')
e.style.display = 'none';
else
e.style.display = 'block';
}
</script>
Click here to toggle visibility of element #foo
<div id="foo" style="display:block">This is foo</div>