Can I get Bootstrap modal content to generate a new url? - html

I'm in the process of adding Facebook like and share buttons to a site I'm working on. What I'm trying to achieve is to have L+S buttons for each item in the portfolio, which are displayed as modal content when a thumbnail is clicked. What is currently happening is that the links to like or share don't include the modal id, which means the whole portfolio page is linked, rather than a specific item.
The html for the thumbnails looks like this:
<div class="col-md-4 col-sm-6 portfolio-item">
<a href="#portfolioModal1" class="portfolio-link" data-toggle="modal">
<img class="img-responsive img-portfolio img-hover" src="img/homePage/700x450alfa.png" alt="Image of the name Alfa cut from 38mm Nordic Spruce">
</a>
</div>
And that links to this:
<div class="portfolio-modal modal fade" id="portfolioModal1" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="close-modal" data-dismiss="modal">
<div class="lr">
<div class="rl"></div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<div class="modal-body">
<h2>Alfa</h2>
<p class="item-intro text-muted">38mm Nordic Spruce</p>
<p>Choose your own name, word or design to be cut from wood. Get in touch to discuss an order like this one</p>
<img class="img-responsive img-centered" src="img/may2017/alfa1.jpg" alt="Image of the name Alfa cut from 38mm Nordic Spruce">
<img class="img-responsive img-centered" src="img/may2017/alfa2.jpg" alt="Image of the name Alfa cut from 38mm Nordic Spruce">
<img class="img-responsive img-centered" src="img/may2017/alfa3.jpg" alt="Image of the name Alfa cut from 38mm Nordic Spruce">
<button type="button" class="btn btn-primary" data-dismiss="modal"><i class="fa fa-times"></i> Close Window</button>
<!--LIKE BUTTON-->
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.7";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<br> </br>
<div class="row text-center">
<div class="fb-like" data-href="https://localhost:8888/TTK2/mainportfolio2.html#portfolioModal1" data-width="200px" data-layout="button" data-action="like" data-show-faces="false" data-share="true"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
As you can see, I've pasted the FB JS right into the div, which I know is poor practice, but I had hoped that this would trigger the modal ID, but it doesn't.
You can also see that I've got the full address including the modal ID in the data-href field of the button div, but any link generated by clicking will not include the modal ID, and instead links to the original page, in this case, Portfolio. BTW, the buttons for the entire page work as they should. The only thing I can't do is link to a modal. Documentation I've read suggests that it might not be possible to do this, but I wanted to check with the community first. I mean, it SHOULD be possible, right?
Ps. I know this code links to a local host address, but it doesn't work in a live situation either.
Thanks for looking.
UPDATE - SOLVED.
I've found a solution to the first part of this, which was being able to change the url of modal content so that I could add Like and Share buttons. It has been answered Here by #forcefield. Have tested on my page of 100+ hidden modal divs and it works perfectly. Thanks #forcefield!

Related

Background image not appearing in webpage in .net

I have put a link to my image but I cant seem to get it to display in my webpage.
I have also tried to put the image in a separate folder but I still couldn't get it to display.
Any help would be much appreciated.
I have attached a photo to show my folder structure
enter image description here
<div class="carousel-inner">
<div class="carousel-item active"
style="background-image: url(./bball.jpg); ">
<div calss="container">
<h1>Example Headline</h1>
<p>
nionsdof nlsdfn klnsdf nsdklfnklsnfd kln
sl;df ;lkfsmdlmsdl;ksm dl;m klms lksfkj sjh
skdf jsdkjfn kn kjnsdf kjnsdkn sdfjk nksdf kj
s fdkjsdfk jnskdj nskdjnf jknfsdkjnskjdnf ks
</p>
<a href="#" class="btn btn-lg btn-primary">
Sign up today
</a>
</div>
</div>
remove the styling image line you made:
style="background-image: url(./bball.jpg);
In your css file, insert this:
carousel-item active.image {
content:url("bball.jpg");
}
or
div.carousel-item active{
background-image:url("bball.jpg");
}

Dynamically added modals aren't triggering

I am loading cards and there modals dynamically and the problem I am facing is that the dynamically added cards aren't triggering the dynamically added modals.
The cards are this
data.forEach(eve => {
console.log(eve.data());
event = eve.data();
pastEventCards+=`
<li class="cards_item">
<div class="card">
<div class="card_image">
<img src="images/posters/cpp_2021.jpeg" />
</div>
<div class="card_content card-body d-flex flex-column">
<h2 class="card_title">${event.title}</h2>
<p class="card_text">
</p>
**<button data-modal-trigger="past-event-modal-${event.eventNo}" class="mt-auto demo__btn demo__btn--secondary">
Read More
</button>**
</div>
</div>
</li>
`
pastEventModals+=`
<div class="modal" data-modal-name="past-event-modal-${event.eventNo}">
<div class="modal__dialog">
<button class="modal__close" data-modal-dismiss>×</button>
<header class="modal__header">
<h2 class="modal__title">${event.title}</h2>
</header>
<div class="modal__content">
<h4 class="modal_description">Description</h4>
</p>
<p>${event.description}</p>
<p class="modal_description">
${event.date}
</p>
<p class="modal_description">Attendees : ${event.attendee}
</p>
<p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-modal-dismiss>Close</button>
</div>
</div>
</div>
`
});
cardsList.innerHTML = pastEventCards ;
modalList.innerHTML = pastEventModals ;
I have tried referring to other stack overflow questions related to this and couldnt find a understandable solution to why this is happening , can anyone tell why the buttons cant trigger the modals ?
**EDIT :: **
The button that triggers the modal is inside this ** ** in the pastEventCards variable and the modal is in pastEventModals and when i use "data-modal-trigger = "something" " it will trigger the modal with modal name "something" right ? So y isnt it happening. If I dont add this modals and trigger cards dynamically and add it in the html template then it works fine but after adding dynamically it doesnt work

Is there a way to display a picture on my website, only if the picture is not a null value on a list?

I'm setting up a User Interface using a simple database and angular, where users can post a message, either with only a message, or with a picture attached to the message.
By doing some research, I found out about the built in ngIf conditions, where you can display variables if the variable doesn't hold a null value.
Here is my code and the output:
<div ng-repeat="m in chatDetailsCtrl.messageList">
<!-- This card prodives space for the message and Like/dislike buttons -->
<div class="row">
<div class="col s12 m6">
<div class="card">
<div class="card-content">
<!-- Card Title is the person who wrote the message -->
<span class="card-title">{{m.user_ID}}</span>
<!-- Here comes the message text -->
<p> {{m.post_msg}}
<div> <span class="new badge light-blue">{{m.post_date}}</span></div>
<p *ngIf="m.photo_url">
<img src="{{m.photo_url}}" width="100" height="100">
</p>
{{m.post_date|date("m/d/Y")}} -->
</p>
<td><a class="waves-effect light blue lighten-1 btn-small" ng-click="chatDetailsCtrl.postDetails(m.post_ID)">Post Details</a></td>
</div>
<div class="card-action">
<a class="btn-floating btn-small waves-effect waves-light blue" ><i class="material-icons">thumb_up
</i></a> <span ng-bind= "m.likes"> </span>
<a class="btn-floating btn-small waves-effect waves-light blue"><i class="material-icons">thumb_down
</i></a><span ng-bind="m.dislikes"> </span>
</div>
</div>
</div>
</div>
</div>
I want to see if m.post_url contains a value. When null, I want to skip adding this variable to my website.
For example, last post, without a picture, I want it to look like this:
Sorry for my bad english, english is not my first language.
first of all, you are mixing angularJs syntax with new angular.
if you are using angularjs use ng-if in your image tag. it works properly.
as I can see you are using ng-repeat and ng-bind you are using angularjs and not angular.
so in your image tag use
<p ng-if="m.photo_url">
<img src="{{m.photo_url}}" width="100" height="100">
</p>

Opaque image over Transparent Background

I want to make image opaque over 70% opaque background. I am working on tboxsolutionz.com/dev12345
When Portfolio item is clicked a div is loaded (Code for that div is given below)
<div class="portfolio-modal modal fade transparent-background in" id="portfolioModal2" tabindex="-1" role="dialog" aria-hidden="false" style="display: block;"><div class="modal-backdrop fade in" style="height: 846px;"></div>
<div class="modal-content">
<!-- <div class="close-modal" data-dismiss="modal">
<div class="lr">
<div class="rl"> </div>
</div>
</div>-->
<div class="container containerport">
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<div class="modal-body">
<!-- Project Details Go Here -->
<h2>Monster Mischief</h2>
<!--<p class="item-intro">Monster is up to a bit of mischief in the new endless runner game built for the pros & casual game players. Monster Mischief is insanely easy to pick up and play with a simple tap to control system. Simply navigate Monster through the obstacles while picking up sweet upgrades along the way to pimp out your character. Available now for your iPhone, iPod, & iPad.</p>-->
<img class="img-responsive img-centered" src="img/portfolio/image11.jpg" alt="">
<p class="zoom-text">Monster is up to a bit of mischief in the new endless runner game built for the pros & casual game players. Monster Mischief is insanely easy to pick up and play with a simple tap to control system. Simply navigate Monster through the obstacles while picking up sweet upgrades along the way to pimp out your character. Available now for your iPhone, iPod, & iPad.</p>
<ul class="list-inline">
<!--<li><strong>Client</strong>: John Doe</li>
<li><strong>Category</strong>: Web Design</li>-->
<li><img src="img/portfolio/App_Store.png" width="120" style="float:right;margin-right: 10px;" align="bottom">
</li>
</ul>
<button type="button" class="btn btn-primary centered" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>
</div>
</div>
</div>
</div>
</div>
</div>
I have tried several aspects from css and html including z-index, making the background of the image white but nothing is working
try to give opacity:0.1;to the image or try overlay div with same opacity.
i did it by following styling
.fade.in
{background-color:rgba(181,181,181,0.7)}
.modal-content
{ z-index:15;
background-color: white
}
but this made the background of content white and rest area transparent

Add software back button in app designer intel xdk at the top

I have 2 pages in my index.html in XDK. I navigate from one to the other. I want to add a back button just like the templates but it's not possible.
This is my html:
<div class="upage vertical-col left" id="mainpage">
<div id="SubPage" class="upage-content vertical-col left ">
<div class="tarea widget uib_w_1 d-margins" data-uib="media/text" data-ver="0" name="uib_w_1">
<div class="widget-container left-receptacle"></div>
<div class="widget-container right-receptacle"></div>
<div class="text-container">
<p>This is the main page</p>
</div>
</div>
<button class="btn widget uib_w_2 d-margins btn-default" data-uib="twitter%20bootstrap/button" data-ver="1" id="buttonSubPage">Go to sub page</button>
</div>
<div id="SubPage2" class="upage-content vertical-col left hidden"><span class="widget uib_w_3 d-margins badge" data-uib="twitter%20bootstrap/badge_and_label" data-ver="1">This is subfile 2</span>
</div>
</div>
I want to add the back button to "SubPage2". How can I achieve this? I'm working with a blank template in the app designer.
Add This code
$(document).ready(function(){
$("#buttonSubPage").click(function(){
$(".text-container").hide();
$("#SubPage2").show();
});
});
See Fiddle
After you add your header to the app designer, switch to the Code view look for the following code in newly created header
<div class="widget-container content-area horiz-area wrapping-col left"></div>
and then add the button code,
<button data-uib="twitter%20bootstrap/button" data-rel="back" data-ver="1" id="back">Back</button>
the data-rel controls the back action, without need for extra javascript.