I've used this Tutorial in order to create a guide
http://www.hongkiat.com/blog/introjs-step-by-step-guide-tutorial/
$(function(){
var introguide = introJs();
// var startbtn = $('#startdemotour');
}
introguide.setOptions({
steps: [
{
element: '.nav-bar',
intro: 'This guided tour will explain the Hongkiat demo page interface.<br><br>Use the arrow keys for navigation or hit ESC to exit the tour immediately.',
position: 'bottom'
},
{
element: '.nav-logo',
intro: 'Click this main logo to view a list of all Hongkiat demos.',
position: 'bottom'
},
{
element: '.nav-title',
intro: 'Hover over each title to display a longer description.',
position: 'bottom'
},
{
element: '.readtutorial a',
intro: 'Click this orange button to view the tutorial article in a new tab.',
position: 'right'
},
{
element: '.nav-menu',
intro: "Each demo will link to the previous & next entries.",
position: 'bottom'
}
]
});
But I could not find a way or I did not understand :)
How to trigger introJs With a button or link.
In addition, I've search on the Internet User's Guide
But I did not find enough information on the subject:(
I tried this:
Show me how
&
<a class="btn btn-large btn-success" href="javascript:void(0);" onclick="startIntro();">Show me how</a>
But nothing happens
please help me
The example is right there on your tutorial page:
var startbtn = $('#startdemotour'); // <-- you need to uncomment this line, or just use $('#startdemotour').on()
startbtn.on('click', function(e){
e.preventDefault();
introguide.start();
$(this).hide();
});
Related
Say I had some code like this:
L.marker({lat: 30.266293, lon: -97.656965}, {icon: myIcon})
.addTo(mymap)
.bindPopup("<a href='#' class='test'>click me!</a>");
I'd like to be able to do $('test').click(function() { ... }); after the popup has loaded.
How might I do that? Is there some sort of onpopupload event I could use?
Yes there is an event on the layer popupopen
var marker = L.marker({lat: 30.266293, lon: -97.656965}, {icon: myIcon})
.addTo(mymap)
.bindPopup("<a href='#' class='test'>click me!</a>");
marker.on('popupopen',(e)=>{
$('.test').click(function() { ... });
});
PS: That the click event will added to the test element, you have to add a point before test, else the element will not found --> $('.test')
I need to add an image on the header of a freestyle portal site which when clicked should open a new window with a specific URL.
Currently tried adding the below code but it appears very small, just like a profile picture. But our requirement is to make it appear more like a logo and on the right side (as an header end item).
var oImageItem = new sap.ushell.ui.shell.ShellHeadItem("imageId", {
icon: "/images/image1.png",
tooltip: "Click here",
//height: "100%",
showSeparator: false,
href: "HarcodeURL",
target: "_blank"
});
oRendererExtensions.addHeaderEndItem(oImageItem);
This link could be very interesting: How to place logo or icon at the Center of Unified Shell header?
You have to change "Center" to "Right" and "Icon" to "Image"
That would look like this:
var oShell = new sap.ui.unified.Shell("oShell", {
header: [
new sap.m.FlexBox({
justifyContent: sap.m.FlexJustifyContent.Center,
items: [
new sap.ui.core.Icon({
src: "sap-icon://home"
})
]
})
]
});
You also could change the "FlexBox" to a "VBox".
This element doesn't exist. Use the "sap.m.Image" element. (SDK sap.m.Image)
Code with XML: <m:Image src="/images/image1.png" width="100px" press="openNewWindow">
Code with JS:
var oImageItem = new sap.m.Image("imageId", {
src: "/images/image1.png",
tooltip: "Click here",
width: "100px",
press="openNewWindow"
});
Press Event in Controller:
openNewWindow: function(){
window.open("https://www.hypej.com");
},
I am developing a Task pane word add-in using JavaScript API, I have used below code to create a jQuery dialogbox dynamically using a function:
function myConfirm(dialogText, okFunc, cancelFunc, dialogTitle) {
$('<div style="padding: 10px; max-width: 500px; word-wrap: break-word;">'
+ dialogText + '</div>').dialog({
draggable: true,
modal: true,
resizable: false,
width: 'auto',
title: dialogTitle || 'Confirm',
minHeight: 75,
position: {
my: "center",
at: "center",
of: window
},
buttons: {
OK: function() {
if (typeof(okFunc) == 'function') {
setTimeout(okFunc, 50);
}
$(this).dialog('destroy');
},
Cancel: function() {
if (typeof(cancelFunc) == 'function') {
setTimeout(cancelFunc, 50);
}
$(this).dialog('destroy');
}
}
});
}
But when i open it first time to call myConfirm function, the page scroll goes to top and when i scroll down to click on dialog-box it again send the scroll back to top then i need to again scroll down, now i am able to click on dialog-box buttons. it works fine after first.
I need to set dynamically text of box and function on button clicks so i am creating it dynamically. I have also test it on Internet Explorer, it's working fine.
Please advice how i can fix it for word add-in.
You can try below code when you are calling your function :-
onclick="myConfirm();return false;"
Just add "return false;" after your function name as shown above.
Edit 1:-
Or you can return false from your function as well.
Edit 2 :-
$form.show().dialog({
close: function (event) { event.preventDefault(); }
resizable: false,
etc....
});
I try to build a map with openlayers3 with a group of markers and popups. The markers and the popups work so far, but when I click on one marker (popup shown) and then -without clicking in the map again- on another one, it shows a popup with the same content as the first one. I have already done research, but can't find something helpful. So here's the part for my popups:
//popup
var element = document.getElementById('popup');
var popup = new ol.Overlay({
element: element,
positioning: 'bottom-center',
stopEvent: false
});
map.addOverlay(popup);
// display popup on click
map.on('click', function(evt) {
var feature = map.forEachFeatureAtPixel(evt.pixel,
function(feature, layer) {
return feature;
});
if (feature) {
var geometry = feature.getGeometry();
var coord = geometry.getCoordinates();
popup.setPosition(coord);
$(element).popover({
'placement': 'top',
'html': true,
'content': feature.get('information')
});
$(element).popover('show');
} else {
$(element).popover('destroy');
}
});
Hope somebody can help me. Thanks!
I was having the same issue and found my solution here https://gis.stackexchange.com/questions/137561/openlayers-3-markers-and-popovers
Try changing your
$(element).popover({
'placement': 'top',
'html': true,
'content': feature.get('information')
});
to
$(element).attr('data-placement', 'top');
$(element).attr('data-html', true);
$(element).attr('data-content', feature.get('information'));
I've made an example for you. Take a look!
You gotta "write" some content on each marker.
http://embed.plnkr.co/hhEAWk/preview
I'm using the leaflet-sidebarv2 plugin to create a sidebar for a cartodb/leaflet map. I'm running into problems that I a.) can't get the options to work – close button, autoPan, etc) and b.) can't use setContent to dynamically set data.
The sidebar functions as expected. The problem is modifying it seems to have no effect. I also get an error "Uncaught TypeError: undefined is not a function" on the setTimeout and setContent lines.
cartodb.createLayer(map, {
user_name: {{user_name}},
type: 'cartodb',
sublayers: [{
sql: 'select * from {{table_name}}',
cartocss: '#layer',
interactivity: 'cartodb_id, name',
auto_bound: true
}]
})
.addTo(map)
.done(function(layer) {
var barData;
barData = layer.createSubLayer({
sql: 'select * from {{table_name}}',
cartocss: '#layer {marker-fill: #bababa; marker-opacity: 0.3; marker-width: 4px; }',
interactivity: 'name, location'
});
//on click
barData.on('featureClick', function(e, pos, pixel, data) {
//log active data
console.log("Name: " + data.name + " # " + data.location);
$('#map').css('cursor', 'pointer');
});
barData.setInteraction(true);
//hover pop-up
var infobox = new cdb.geo.ui.InfoBox({
width: 100,
layer: layer,
template: '<p class="cartodb-infobox">{{name}}</p></br><p>{{location}}</p>',
position: 'top|right' // top, bottom, left and right are available
});
$("body").append(infobox.render().el);
// leaflet-sidebar> closeButton not engaging
var sidebar = L.control.sidebar('sidebar', {closeButton: true});
map.addControl(sidebar);
//content not showing up anywhere
sidebar.setContent('test <b>test</b> test');
// sidebar still collapsed at reload
setTimeout(function () {
sidebar.show();
}, 500);
});
}
window.onload = main;
Any suggestions on what I might be doing wrong? I've got all the right pieces loaded in the head.
You seem to be using the wrong API. The setContent() method and the options hash is part of the leaflet-sidebar library API, but not of sidebar-v2.