I'm trying to display a one line list of elements.
This list is browsed using the scrollbar.
Each element can be removed on click with a transtion making it go up and fade.
I came up with the following code:
new Vue({
el: '#container',
data: { blocks: [1, 2, 3, 4, 5, 6, 7] }
})
#container {
position: relative;
height: 100px;
width: 200px;
border: 1px solid black;
overflow-x: scroll;
}
.block {
position: absolute;
bottom: 0px;
height: 40px;
width: 40px;
background-color: blue;
cursor: pointer;
}
.rise-fade-leave-active,
.rise-fade-move {
transition: all 0.5s ease;
}
.rise-fade-leave-to {
transform: translateY(-40px);
opacity: 0;
}
<script src="https://unpkg.com/vue#2.6.11/dist/vue.min.js"></script>
<div id="container">
<transition-group name="rise-fade" tag="div">
<div v-for="(b, i) in blocks"
v-bind:key="b"
v-bind:style="{ left: i*50 + 'px' }"
v-on:click="blocks.splice(i, 1)"
class="block">
</div>
</transition-group>
</div>
But if I scroll to the most right and click on any visible element except the last one, the element seems to be pushed to the right during the list move transition.
Is there a way to prevent this?
I would like to have my element rising just vertically no matter the scroll value.
jquery file
above is my jquery code. I want every time I click the frog image, it will move to the left 50 pixels. but when I run the code, it keeps saying "Invalid keyframe value for property left: +=50px"
google console
Here's a working example.
$("#clickme").click(function(){
$(this).animate({ "left": "-=50px" }, "slow" );
});
#clickme {
position: absolute;
background: red;
width: 100px;
left: 0;
right: 0;
margin: 0 auto;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="clickme">Click me</div>
Bump. Any idea? Thank you!
-
Displaying 3 slides/images per view, looped, centered.
With a clean cache, Swiper starts with the last slide and misses the first to the right. Browser refresh seems to fix it: swiper starts/initializes with first slide, no blank slides remain.
The amount of images is dynamic.
UPDATE:
The issue is with the CSS we added:
.swiper-container {
width: 100%; height: 100%;
margin-left: auto; margin-right: auto;
}
.swiper-slide {
max-width: 1200px;
height: auto;
text-align: center;
line-height: 0;
}
.swiper-slide img {
height: 550px;
width: auto;
}
.swiper-slide:nth-child(1n) {
height: 550px;
width: auto;
}
Removing the very last bit (nth-child) resets the slider to always start with the first slide. But the images stop sitting next to each other, but instead are spread apart.
Created this to demonstrate a little quicker:
http://jsfiddle.net/L3b1fzh9/13/
You can remove the last few lines of CSS, because .swiper-slide:nth-child(1n) matches every single .swiper-slide element, so this selector doesn't actually do anything (n is a set of all integers, so when you multiply by 1 you just get 0, 1, 2, etc.).
The reason why the images stop sitting next to each other is that their parent container .swiper-slide has width: 100%. You need to change that to width: auto and add margin: 0 auto to center the slides.
So your .swiper-slide CSS becomes:
.swiper-slide {
max-width: 1200px;
height: auto;
text-align: center;
line-height: 0;
width: auto !important;
margin: 0 auto;
}
And just remove the .swiper-slide:nth-child(1n) CSS.
Updated fiddle
Am creating an image editor library with the support of KinetiJS.
In my html,
<div id="editorarea" class="fill">
<div id="imageContainerDiv" class="imageContainerDiv" >
<div>....</div>
<div>....</div>
<div id='rotateouterDiv' class='rotateouterDiv' >
<textarea placeholder='Enter You Text here' id='inputField' name='graffiti' class='textContainerMob'></textarea>
</div>
<div id='imageContainer'></div>
</div>
</div>
Then creating a stage
_kineticStage = new editor._Stage({
container : 'imageContainer',
width : $('#editorarea').width(),
height : $('#editorarea').height()
});
Kinetic.Util.extend(editor._Stage, Kinetic.Stage);
And adding an image,
_kineticImage = new editor._Image({
x : 0,
image : img,
y : 0,
draggable : true,
});
layer.add(_kineticImage);
The CSS applied is,
#editorarea {
width: 100%;
height: 80%;
margin-top: .1%;
min-height: 70%%;
display: block;
border-width: 2px;
border-style: solid;
}
.fill {
min-height: 85%;
height: 90%;
}
.imageContainerDiv {
width: 100%;
height: 100%;
z-index: 0;
left: 0;
right: 0;
background-color: #FFF;
display: block;
background-image: url(../images/back_pattern.png);
background-repeat: repeat;
overflow: hidden;
}
The textarea should be on the top of the image. In this case, I placed that div containing the textarea using the #media queries, for supporting different screen size and orientation.
The issue occurs when following the steps: load the page in portrait, then change the device orientation to landscape. Then the position of textarea is not correct. This is because the kinetic stage is not properly resizing on orientation change (only the area with image).
Can anyone help me to resize it properly? This should work in touch devices.
Thanks...
here's my code :
<style>
div.img {
margin: 5px;
padding: 0px;
height: auto;
width: auto;
float: left;
}
div.img span.img {
display: inline-block;
}
a.img:hover img {
}
.jssorb03 {
position: absolute;
}
.jssorb03 div, .jssorb03 div:hover, .jssorb03 .av {
position: absolute;
/* size of bullet elment */
width: 21px;
height: 21px;
text-align: center;
line-height: 21px;
color: white;
font-size: 12px;
background: url(../img/b03.png) no-repeat;
overflow: hidden;
cursor: pointer;
}
.jssorb03 div {
background-position: -5px -4px;
}
.jssorb03 div:hover, .jssorb03 .av:hover {
background-position: -35px -4px;
}
.jssorb03 .av {
background-position: -65px -4px;
}
.jssorb03 .dn, .jssorb03 .dn:hover {
background-position: -95px -4px;
}
<div class="gallery-page" style="margin: 75px auto; text-align: center;">
<div id="slider1_container" class="hidden-xs" style="position: relative; top: 0px; width: 800px; height: 300px; overflow: hidden;text-align:center;">
<div u="slides" style="cursor: move; position: absolute; top: 0px; width: 780px; height: 300px; overflow: hidden;">
#foreach (var item in fa.get_albums())
{
url = "~/content/images/" + item.picture;
if (#item.Show.Equals(true))
{
<div class="hidden-xs" style="width:250px;display: inline-block;margin-right:25px;">
<a href="/Home/show_album/#item.id" class="img">
<div class="img opct-jq" style="opacity: 0.75; filter: alpha(opacity=75);display:flex;background-image:url('#Url.Content(url)');background-position;background-repeat: no-repeat;background-position: left top;background-size: 100%;width:250px;height:250px;"> </div>
</a>
<p style="width:100%;color:#105c59;text-align:center;font-size:16px;font-weight:100;font-family:'Malgun Gothic'">#Html.DisplayFor(modelItem => item.name)</p>
</div>
}
}
</div>
<!-- Arrow Left -->
<span u="arrowleft" class="jssora03l hidden-xs" style="top: 110px; left: -1px; background-image: url('../../../Content/slider arrow left.png');">
</span>
<!-- Arrow Right -->
<span u="arrowright" class="jssora03r hidden-xs" style="top: 110px; right: -11px; background-image: url('../../../Content/slider arrow right.png');">
</span>
</div>
and here is my Jssor setting scripts
<script>
jQuery(document).ready(function ($) {
var options = {
$AutoPlay: true, //[Optional] Whether to auto play, to enable slideshow, this option must be set to true, default value is false
$AutoPlaySteps: 1, //[Optional] Steps to go for each navigation request (this options applys only when slideshow disabled), the default value is 1
$AutoPlayInterval: 4000, //[Optional] Interval (in milliseconds) to go for next slide since the previous stopped if the slider is auto playing, default value is 3000
$PauseOnHover: 3, //[Optional] Whether to pause when mouse over if a slider is auto playing, 0 no pause, 1 pause for desktop, 2 pause for touch device, 3 pause for desktop and touch device, 4 freeze for desktop, 8 freeze for touch device, 12 freeze for desktop and touch device, default value is 1
$ArrowKeyNavigation: true, //[Optional] Allows keyboard (arrow key) navigation or not, default value is false
$SlideDuration: 950, //[Optional] Specifies default duration (swipe) for slide in milliseconds, default value is 500
$MinDragOffsetToSlide: 50, //[Optional] Minimum drag offset to trigger slide , default value is 20
$SlideWidth: 250, //[Optional] Width of every slide in pixels, default value is width of 'slides' container
//$SlideHeight: 150, //[Optional] Height of every slide in pixels, default value is height of 'slides' container
$SlideSpacing: 15, //[Optional] Space between each slide in pixels, default value is 0
$DisplayPieces: 3, //[Optional] Number of pieces to display (the slideshow would be disabled if the value is set to greater than 1), the default value is 1
$ParkingPosition: 0, //[Optional] The offset position to park slide (this options applys only when slideshow disabled), default value is 0.
$UISearchMode: 1, //[Optional] The way (0 parellel, 1 recursive, default value is 1) to search UI components (slides container, loading screen, navigator container, arrow navigator container, thumbnail navigator container etc).
$PlayOrientation: 1, //[Optional] Orientation to play slide (for auto play, navigation), 1 horizental, 2 vertical, 5 horizental reverse, 6 vertical reverse, default value is 1
$DragOrientation: 1, //[Optional] Orientation to drag slide, 0 no drag, 1 horizental, 2 vertical, 3 either, default value is 1 (Note that the $DragOrientation should be the same as $PlayOrientation when $DisplayPieces is greater than 1, or parking position is not 0)
$BulletNavigatorOptions: { //[Optional] Options to specify and enable navigator or not
$Class: $JssorBulletNavigator$, //[Required] Class to create navigator instance
$ChanceToShow: 0, //[Required] 0 Never, 1 Mouse Over, 2 Always
$AutoCenter: 0, //[Optional] Auto center navigator in parent container, 0 None, 1 Horizontal, 2 Vertical, 3 Both, default value is 0
$Steps: 1, //[Optional] Steps to go for each navigation request, default value is 1
$Lanes: 1, //[Optional] Specify lanes to arrange items, default value is 1
$SpacingX: 0, //[Optional] Horizontal space between each item in pixel, default value is 0
$SpacingY: 0, //[Optional] Vertical space between each item in pixel, default value is 0
$Orientation: 1 //[Optional] The orientation of the navigator, 1 horizontal, 2 vertical, default value is 1
},
$ArrowNavigatorOptions: {
$Class: $JssorArrowNavigator$, //[Requried] Class to create arrow navigator instance
$ChanceToShow: 2, //[Required] 0 Never, 1 Mouse Over, 2 Always
$AutoCenter: 0, //[Optional] Auto center navigator in parent container, 0 None, 1 Horizontal, 2 Vertical, 3 Both, default value is 0
$Steps: 1 //[Optional] Steps to go for each navigation request, default value is 1
}
};
var jssor_slider1 = new $JssorSlider$("slider1_container", options);
in all browsers i can redirect to the url of the tag that has been made by the foreach but in safari nothing will happen.
Any help would be appreciated.
Try adding a style of display:block to the href.
<div>
<a u="image" href="www.example.com" style="display:block">
<img src="/example.png" />
</a>
</div>
i fixed the problem by putting the <p> tag in the <a class="img">.
safari went nuts when i put <a> and <p> near each other in parent <Div>
so i change this:
<div class="hidden-xs" style="width:250px;display: inline-block;margin-right:25px;">
<a href="/Home/show_album/#item.id" class="img">
<div class="img opct-jq" style="opacity: 0.75; filter: alpha(opacity=75);display:flex;background-image:url('#Url.Content(url)');background-position;background-repeat: no-repeat;background-position: left top;background-size: 100%;width:250px;height:250px;"> </div>
</a>
<p style="width:100%;color:#105c59;text-align:center;font-size:16px;font-weight:100;font-family:'Malgun Gothic'">#Html.DisplayFor(modelItem => item.name)</p>
</div>
to this :
<div class="hidden-xs" style="width:250px;display: inline-block;margin-right:25px;">
<a href="/Home/show_album/#item.id" class="img">
<div class="img opct-jq" style="opacity: 0.75; filter: alpha(opacity=75);display:flex;background-image:url('#Url.Content(url)');background-position;background-repeat: no-repeat;background-position: left top;background-size: 100%;width:250px;height:250px;"> </div>
<p style="width:100%;color:#105c59;text-align:center;font-size:16px;font-weight:100;font-family:'Malgun Gothic'">#Html.DisplayFor(modelItem => item.name)</p>
</a>
</div>
hope it could help someone else