In my app, I have the right slide bar that contains Vue components that represent system notifications. By default, the right bar is hidden (out of the screen) and when the user opens it the bar is blank(meaning no components displayed). In DevTools, I can see that Vue components weren't rendered
However, if I put the same code from right.blade.php to any normal view then every notification will be displayed.
My assumption so far, the Vue cannot render components in hidden HTML. Am I correct?
Here is the screenshot that demonstrates the presents of PHP code and the absence of Vue component, and the code itself:
right bar screenshot
rightbar.blade.php
<div id="rightbar" class="rightbar">
<div class="mt-2">
<ul class="nav nav-tabs2">
<li class="nav-item"><a class="nav-link active show" data-toggle="tab" href="#notifications">Notifications</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#channels">Channels</a></li>
</ul>
<hr>
<div class="tab-content">
<div class="tab-pane show active" id="notifications">
#foreach(auth()->user()->unreadNotifications as $key => $notification)
<p>here</p> //<---------------------------this works
<notification props_id="{{$notification->id}}"
props_route="{{route('item.show',$notification['data']['item']).'#documents'}}"
props_title="New item uploaded"
props_body="User {{$notification['data']['name']}} uploaded {{$notification['data']['item']}}"
props_date="{{$notification->created_at}}">
</notification> //<------------------------- this doesn't works
#endforeach
</div>
<div class="tab-pane" id="channels">
<p>channel 1</p>
<p>channel 2</p>
<p>channel 3</p>
</div>
</div>
</div>
</div>
Notification.vue
<template>
<transition name="slide-fade">
<div class="card" v-show="showNotification" >
<div class="header">
<h2 v-text="title"></h2>
<ul class="header-dropdown dropdown">
<li><i class="fa fa-close"></i></li>
</ul>
</div>
<div style="cursor:pointer" #click="openSubject()">
<div class="card-body">
<p class="card-text" v-text="body"></p>
</div>
<div class="card-footer">
<small class="text-muted" v-text="date"></small>
</div>
</div>
</div>
</transition>
</template>
<script>
export default {
props: {
props_id: String,
props_route: String,
props_title: String,
props_body: String,
props_date: String,
},
name: "Notification",
data(){
return{
id: this.props_id,
route: this.props_route,
title: this.props_title,
body: this.props_body,
date: this.props_body,
showNotification: true,
}
},
methods:{
openSubject(){
location.href = this.route;
this.markAsRead()
},
markAsRead(){
axios
.put("/notifications/"+this.id)
.then(response => {
this.deleteNotification()
})
.catch(error => console.log(error))
},
deleteNotification(){
this.showNotification = false;
},
},
mounted() {
console.log('Vue notification')
}
}
</script>
<style>
.slide-fade-enter-active {
transition: all .3s ease;
}
.slide-fade-leave-active {
transition: all .5s cubic-bezier(1.0, 0.5, 0.8, 1.0);
}
.slide-fade-enter, .slide-fade-leave-to
/* .slide-fade-leave-active below version 2.1.8 */ {
transform: translateX(1000px);
opacity: 0;
}
</style>
app.js
Vue.component('notification', require('./components/Notification.vue').default);
rightbar.scss
.rightbar{
#include box-shadow(0 5px 10px 0px rgba($dark,.3));
#include transition(all .3s ease-in-out);
background: $body-color;
position: fixed;
top: 0;
right: -500px;
width: 500px;
height: 100vh;
overflow-y: scroll;
z-index: 13;
padding: 8px 20px;
&.open{
right: 0;
}
#include max-screen($break-medium) {
width: 450px;
}
#include max-screen($break-small - 1px) {
width: 340px;
}
.chat_detail{
display: block;
position: relative;
.chat-widget{
height: calc(100vh - 200px);
overflow-y: auto;
}
.input-group{
position: fixed;
bottom: 10px;
width: 460px;
#include max-screen($break-medium) {
width: 410px;
}
#include max-screen($break-small - 1px) {
width: 300px;
}
}
}
}
Your DevTools screenshot shows <notification> instead of the component's rendered elements, indicating that the component is not actually registered.
I would check the component registration in your view.
Related
Trying to scale a div in SCSS without using Javascript.
I know how to do this in CSS, but I can't get the syntax right in SCSS. How do I do?
When the checkbox is toggled, the external div should transform. I am using transform: scale().
Codepen link.
HTML:
<input type="checkbox" id="toggle" class="toggle" />
<div id="container">
<label for="toggle" class="nav-toggle-label">
Toggle me
</label>
</div>
<div class="responsive">
<ul class="nav-links">
<li>Link 1</li>
<li>Link 2</li>
</ul>
</div>
SCSS:
#container {
background: lightblue;
width: 10vw;
height: 10vh;
&:checked + .responsive {
transform: scale(1, 1);
}
}
.responsive {
background: orange;
width: 10vw;
height: 10vh;
transform: scale(1, 0);
}
In the css or scss/sass doesn't have bubbling behavior. In your case need to get the element in same level and get it with ~ selector. codepen example
#container {
background: lightblue;
width: 10vw;
height: 10vh;
}
.responsive {
background: orange;
width: 10vw;
height: 10vh;
transform: scale(1, 0);
}
#toggle:checked ~ .responsive {
transform: scale(1, 1);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/sass.js/0.11.1/sass.min.js"></script>
<input type="checkbox" id="toggle" class="toggle">
<div id="container">
<label for="toggle" class="nav-toggle-label">
Toggle me
</label>
</div>
<div class="responsive">
<ul class="nav-links">
<li>Link 1</li>
<li>Link 2</li>
</ul>
</div>
Can anyone help me with a javascript to make the page scroll down to the searchbox when the searchfield is focused? Like if you click on the searchfield, the position changes, until the red and yellow boxes are out of sight.
#overtop {
width: 500px;
height: 100px;
background: red;
}
#top {
width: 500px;
height: 100px;
background: yellow;
}
#searchbox {
}
#content {
width: 500px;
height: 200px;
background: blue;
}
<div id="overtop">
</div>
<div id="top">
</div>
<div id="searchbox">
<input type="text" id="myInput" placeholder="enter.." title="search">
</div>
<div id="content">
</div>
Just got it, finally.
$("#myInput").click(function () {
$("html, body").animate({ scrollTop: $("#searchbox").offset().top }, 300);
return true;
});
Using Twitter Bootstrap 3, I have a container, three div place holders, and three images that fill as links each floated side by side and taking up the entire row: When I minimize the screen to make it responsive, I only see the first image (the second two dissapear). What steps would I have to take to make sure that each image becomes responsive and sits one below the other at the minimize dmobile display screen.
Please Note: Each Img. already has class="img-responsive" applied to it.
HTML:
<!--Wide Display Container -->
<div class="wide-display">
<div id="firstholder">
<a href="home.html" title="Home" class="imglink"><img src="/images/slide2.JPG" alt="City Lights Image" class="img-responsive" id="electricone">
<div class="item1">
<h1 class="slickfont1" >First Title</h1>
</div>
</a>
</div>
<div id="secondholder">
<a href="office.html" title="Office" class="imglink"><img src="/images/ant.JPG" alt="City Lights Image" class="img-responsive" id="electrictwo">
<div class="item1">
<h1 class="slickfont1" >Second Title</h1> </div></a>
</div>
<div id="thirdholder">
<a href="reviews.html" title="Locations" class="imglink"><img src="/images/family.JPG" alt="City Lights Image" class="img-responsive" id="thirdelectric">
<div class="item1">
<h1 class="slickfont1" > Third Title</h1>
</div>
</a>
</div>
</div><!-- Wide Display Container -->
CSS:
.wide-display {
min-width:33%;
position: relative;
width: 100%;
height:100%;
margin-top:6px;
overflow: hidden;
height:366px;
}
/*! First img Holder */
#firstholder {
width: 449px;
height: 100%;
float:left;
display:inline-block;
margin-left:1px;
margin-right:0px;
}
.item1 {
width: 24%;
margin: auto;
position:relative;
}
#secondholder {
width: 450px;
height: 100%;
float:left;
display:inline-block;
margin-right:0px;
}
#thirdholder {
width: 449px;
height: 100%;
float:left;
display:inline-block;
}
You have to create Bootstrap Grid to make it work. You can just read the documentation here: http://getbootstrap.com/css/ it's pretty easy to understand. The divs that wrap you images need to have grid classes applied to them.
I have seven divs with id 1 to 7 in my html when I resize my window diagonally then the fittextjs plugin resizes the text within the 7 divs thats fine.
When I resize the window horizontally then the font-size decreases/increases fine...
What is not working as expected is: When I resize the window only vertically then the font-size does not decrease/shrink.
How can I make it work for the last non-working case?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>FitText</title>
<style type="text/css">
body, html {
width: 100%;
height: 100%;
font-family: arial;
/*overflow: hidden;*/
}
* { /* Every element which has a border or padding value puts this value inside the div */
box-sizing: border-box;
-moz-box-sizing: border-box;
padding: 0;
margin: 0;
}
._Z {
width: 12.50%;
}
.Stack {
display: table;
height: 100%;
float: left;
}
.Stack li {
list-style: none;
display: table-row;
}
.Stack li div {
display: table-cell;
}
.horizontal-right {
text-align: right;
}
.horizontal-center {
text-align: center;
}
.vertical-center {
vertical-align: middle;
}
#responseView {
height: 100%;
}
</style>
<!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
</head>
<body>
<div id="responseView" data-bind="swipeLeftRightContentViews: $root.showMapView">
<div style="height: 100%;">
<ul class="Stack _Z" data-bind="foreach: replyTimeStack.segments">
<li style="height:14.2%;background: green; color: black;">
<div id="div1" style="border-bottom:white solid 1px;" class="horizontal-center vertical-center">1</div>
</li>
<li style="height:14.2%;background: green; color: black;">
<div id="div2" style="border-bottom:white solid 1px;" class="horizontal-center vertical-center">2</div>
</li>
<li style="height:14.2%;background: green; color: black;">
<div id="div3" style="border-bottom:white solid 1px;" class="horizontal-center vertical-center">3</div>
</li>
<li style="height:14.2%;background: green; color: black;">
<div id="div4" style="border-bottom:white solid 1px;" class="horizontal-center vertical-center">4</div>
</li>
<li style="height:14.2%;background: yellow; color: black;">
<div id="div5" style="border-bottom:white solid 1px;" class="horizontal-center vertical-center">5</div>
</li>
<li style="height:14.2%;background: orange; color: black;">
<div id="div6" style="border-bottom:white solid 1px;" class="horizontal-center vertical-center">6</div>
</li>
<li style="height:14.2%;background: green; color: black;">
<div id="div7" style="border-bottom:white solid 1px;" class="horizontal-center vertical-center">7</div>
</li>
</ul>
</div>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="jquery.fittext.js"></script>
<script type="text/javascript">
$("#div1").fitText(1.0, { minFontSize: '7px', maxFontSize: '16px' });
$("#div2").fitText(1.0, { minFontSize: '7px', maxFontSize: '16px' });
$("#div3").fitText(1.0, { minFontSize: '7px', maxFontSize: '16px' });
$("#div4").fitText(1.0, { minFontSize: '7px', maxFontSize: '16px' });
$("#div5").fitText(1.0, { minFontSize: '7px', maxFontSize: '16px' });
$("#div6").fitText(1.0, { minFontSize: '7px', maxFontSize: '16px' });
$("#div7").fitText(1.0, { minFontSize: '7px', maxFontSize: '16px' });
</script>
</body>
</html>
In order to make it work like that, you should tweak their resizer function in the script... setting up to measure the font size based on height rather than width.
$this.css('font-size', Math.max(Math.min($this.height() / (compressor*2), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)));
that should make it work based on the height..
Cheers!
I have two containers, each container containing rows that center the icons and text on the page. You can see example of this here: http://laurelnatale.me/newport/index.html
Unless you are using FireFox. Then the rows are not following the spans and are to the far left of the page. I have been fiddling with this for a while, now trying push, pull, different asides, nothing is working, as if it is not reading anything else but that they should be in the container.
Here is the code:
<div class="container">
<div class=" row minipush">
<div class="span2 offset2">
<div class="bigIcon"><a class="skylink" href="skills.html">Sk</a></div>
<div class="hitext">skills</div>
</div>
<div class="span4">
<div class="bigIcon"><a class="skylink" href="#">Pr</a></div>
<div class="hitext">projects</div>
</div>
<div class="span2 push2">
<div class="bigIcon"><a class="skylink" href="#">Tk</a></div>
<div class="hitext">toolkit</div>
</div>
</div><!--row end-->
</div><!--container end-->
<div class="container">
<div class=" row minipush2">
<div class="span3 offset4">
<div class="email">
<img class="emailicon" src="images/email.png" alt="email Laurel Natale">
<div class="hitext mail">email</div>
</div>
</div>
<div class="span3 pull2">
<div class="twitter">
<img class="twittericon" src="images/twitter.png" alt="Follow Laurel Natale on Twitter">
<div class="hitext tweet">twitter</div>
</div>
</div>
</div><!--row end-->
</div><!--container end-->
Here is the CSS:
.minipush2 {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
margin-top: 5%;
#include breakpoint(baby-bear) {
padding-left: 15%;
margin-top: 10%;
}
}
.hitext {
padding-bottom: 1em;
}
.mail {
margin-left: - 12em;
#include breakpoint(mama-bear) {
margin-left: -8em;
}
#include breakpoint(baby-bear) {
margin-left: 1em;
}
}
.tweet {
margin-left: - 12em;
#include breakpoint(mama-bear) {
margin-left: -8em;
}
#include breakpoint(baby-bear) {
margin-left: 1em;
}
}