Commit 5490ac1f authored by c24b's avatar c24b

TOOLTIP

parent 3f9c4420
function popOverFactory(selector, pos, confirmation){
function popOverFactory(selector, step, pos){
//Factory for popover indicated by class tour
// transforming into btn and mapping title and content
// $(selector).attr({ "type": "button",
// "data-toggle": "popover",
// "data-placement": pos,
// "data-trigger": "toogle",
//
// });
var title = $(selector).attr('name');
var placement = $(selector).attr('placement');
console.log(title)
console.log(placement)
if (title == false || title == undefined) {
title = "<h1>STEP"+ step +"</h1>"
}
if (placement == false || placement == undefined) {
placement: pos
}
$(selector).popover({
html:true,
title: '<h1>'+$(selector).attr("title")+'</h1>',
title : title,
content: '<p class="text-center">'+$(selector).attr("content")+'</p>'+
'<div class="btn-group col-sm-12">'+
'<button class="col-sm-6 btn btn-sm btn-danger" data-role="prev">&laquo; Prev</button>'+
......@@ -17,46 +22,17 @@ function popOverFactory(selector, pos, confirmation){
'</div><br>',
container: 'body',
trigger:"toogle",
placement: pos
placement: placement
});
//$('.btn').not(this).popover('hide');
//$(selector).popover('toggle');
};
var steps = {}
function getStep(element, i){
steps = $(document).find(".tour")
console.log("curr", element);
$(document).on("click", "button[data-role='next']", function(e){
$(element).popover("hide");
native_pop = $(element).children()
native_pop.popover("show");
i = i+1
return i
})
$(document).on("click", "button[data-role='prev']", function(i){
$(element).popover("hide");
native_pop = $(element).children()
native_pop.popover("show");
i = i-1
return i
})
element = steps[i]
popOverFactory(element, "right");
$(element).popover("show");
alert(i);
return [element, i];
}
function nextStep(element, i){
steps = $(document).find(".tour")
$(document).on("click", "button[data-role='next']", function(e){
console.log("curr", element);
$("div.jumbotron" > "button.popover")
native_pop = $(element).children()
//native_pop.addClass("tour")
......@@ -72,7 +48,7 @@ function nextStep(element, i){
if (submit.length >= 1){
$(document).on("click", submit, function(e){
i = i+1
"clicked"
alert("clicked")
})
}
else{
......@@ -95,7 +71,7 @@ function nextStep(element, i){
element = steps[i]
console.log("next", element);
popOverFactory(element, "right");
popOverFactory(element, i, "right");
$(element).popover("show");
return [element, i];
......@@ -114,27 +90,20 @@ function activateTour(){
}
else {
$(this).parent().addClass("active");
curr = $(this)
i = -1
//create the popover
popOverFactory($(this), "bottom", true);
popOverFactory(curr, i, "bottom");
//hide the other popover
$('.popover').not(this).popover('hide');
//show the popover
$(this).popover('toggle');
//buildTour
curr = $(this)
i = -1
//curr, i = getStep(curr,i)
curr, i = nextStep(curr, i)
console.log(i, curr)
if (i > steps.lenght){
return false
}
if (i == -2){
return false
}
if (curr == "undefined"){
return false
}
}
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment