Hide first Section - wordpress

i have the following code. I want that the first part hides when i click on the button.
Can somebody help?
thank you in advance
</div>
<img src="https://sampleurl.com/wp-content/uploads/2021/02/Brief.png" style="width:150px;height:91px;" /><br />
<style type="text/css">.myimgdivtoggle{ display:none;}
</style>
<script>$(document).ready(function(){ $('.togglebtn').click(function(){ $('.myimgdivtoggle').toggle(); });});</script><button class="togglebtn" type="button"><span class="cp_responsive cp_font" data-font-size="20px" style="font-size:20px;"><span data-font-size="18px"><span data-font-size="22px"><span data-font-size="20px"><span data-font-size="19px"><span style="font-family:lato;"><span style="color:#FFFFFF;" date-dismiss=“modal“ arialabel=“Close“>JETZT LESEN</span></span></span></span></span></span></span></button>
<div class="myimgdivtoggle"><img alt="display image on button click" class="img-responsive img-thumbnail" src="https://sampleurl.com/wp-content/uploads/2021/03/Krankmeldung_neu.jpg" /></div> ```

You been to select the both image elements and toggle each inversely.
<div class="myimgdivtoggle2">
<img src="https://sampleurl.com/wp-content/uploads/2021/02/Brief.png" style="width:150px;height:91px;" /><br />
</div>
<button class="togglebtn" type="button">
<span class="cp_responsive cp_font" data-font-size="20px" style="font-size:20px;">
<span data-font-size="18px">
<span data-font-size="22px">
<span data-font-size="20px">
<span data-font-size="19px">
<span style="font-family:lato;">
<span style="color:#FFFFFF;" date-dismiss=“modal“ arialabel=“Close“>
JETZT LESEN
</span>
</span>
</span>
</span>
</span>
</span>
</span>
</button>
<div class="myimgdivtoggle">
<img alt="display image on button click" class="img-responsive img-thumbnail" src="https://sampleurl.com/wp-content/uploads/2021/03/Krankmeldung_neu.jpg" />
</div>
<style type="text/css">
.myimgdivtoggle2{
display:none;
}
</style>
<script>
$(document).ready(function () {
$( ".togglebtn").click(function () {
$( ".myimgdivtoggle" ).toggle();
$( ".myimgdivtoggle2" ).toggle();
});
});
</script>

Related

How to style a tooltip?

I have a tooltip that displays two sets of different info. I need to see some kind of break between the two because right now it all in one single line.
<ng-template #template let-anchor>
<span style="font-size: 17px;">
Last Sale Date : {{ lastSale.lastSaleDate }}
</span>
<span style="font-size: 17px;">
Next Sale Date: {{ nextFuture.nextFutureDate }}
</span>
</ng-template>
<div kendoTooltip
showOn="none"
[tooltipTemplate]="template"
filter=".k-grid td"
(mouseover)="showTooltip($event)">
I would like to see it in a nice format and 2 separte lines so it doesn't overlap.
You can try with this code
$(function(){
// Enables popover
$("[data-toggle=popover]").popover();
});
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.js"></script>
<div class="container">
<div class="row">
<a tabindex="0"
class="btn btn-lg btn-primary"
role="button"
data-html="true"
data-toggle="popover"
data-placement="bottom"
data-trigger="focus"
title="<b>Example popover</b> - title"
data-content="<div>Click <i class="fa fa-rss" aria-hidden="true"></i>
<hr>
</div>
</div>
</div>

Dropdown menu is not closing when clicked outside the menu

When I click outside the menu the drop-down menu is not closing. I have tried with functions but I was not able to solve it.
<div onclick="document.getElementsByClassName('custom-menu-cont')[0].classList.toggle('hidden')"; class="custom-menubutton">
<i class="glyphicon glyphicon-th" style="font-size:20px;"></i>
</div>
</div>
<div class="custom-menu-cont hidden">
<div class="custom-menu">
<div class="arrow-up"></div>
<div>
<div class="custom-menu-item">
<a href="http://blog.fossasia.org" target="_blank">
<div class="custom-icon"><img src="{{ url_for('static', filename='blog.png') }}"></div>
<p class="custom-title">Blogs</p></a>
</div>
<hr style="margin-bottom: 10px; margin-top: 10px;">
<div class="custom-menu-item">
<a href="https://susper.com/" target="_blank">
<div class="custom-icon"><img src="{{ url_for('static', filename='susper.png') }}" style="width: 60px;height: 16px;"></div>
<p class="custom-title">Susper</p></a>
</div>
<div class="custom-menu-item">
<a href="https://chat.susi.ai/" target="_blank">
<div class="custom-icon"><img src="{{ url_for('static', filename='susi.png') }}"></div>
<p class="custom-title">Susi</p></a>
</div>
<div class="custom-menu-item">
<a href="https://loklak.org/" target="_blank">
<div class="custom-icon"><img src="{{ url_for('static', filename='loklak.png') }}"></div>
<p class="custom-title">loklak</p></a>
</div>
<div class="custom-menu-item">
<a href="https://phimp.me/" target="_blank">
<div class="custom-icon"><img src="{{ url_for('static', filename='phimp.png') }}"></div>
<p class="custom-title">Phimp.me</p></a>
</div>
<div class="custom-menu-item">
<a href="https://pslab.fossasia.org" target="_blank">
<div class="custom-icon"><img src="{{ url_for('static', filename='Pslab.png') }}"></div>
<p class="custom-title">PS Lab</p></a>
</div>
<hr style="margin: 10px">
<div style="display: flex;justify-content: center;align-items: center; margin: 0 0 -20px 0">
More on labs.fossasia.org
</div>
</div>
</div>
</div>
What changes I have to do to close the menu?
help me to close the dropdown menu.
Thanks in advance
You can use javascript to achieve that.
function hideDiv(){
document.getElementsByClassName('custom-menu-cont')[0].classList.remove('hidden');
}
document.addEventListener("click", hideDiv, false);
You can also remove onclick from <div class="custom-menubutton"> and write in javascript as it is a better convention.
function hideDivStopPropagation(e) {
document.getElementsByClassName('custom-menu-cont')[0].classList.toggle('hidden');
e.stopPropagation();
}
document.getElementsByClassName('custom-menubutton')[0].addEventListener("click", hideDivStopPropagation, false);
The easier way is to use JQuery.
$(document).on('click', function() {
$('.custom-menu-cont').toggleClass('hidden');
});
$('.custom-menubutton').on('click', function(e) {
e.stopPropagation();
$('.custom-menu-cont').toggleClass('hidden');
});
Note: I used e.stopPropagation() because, when you click on the div.custom-menubutton, It means I clicked on document too. So it runs hideDiv function and hides the menu always(Even if you click div to open dropdown). So e.stopPropagation() prevents your click propagating all the way to the document.

How to skip part-shown images when using overflow: hidden?

I'm trying to do a "read more" function.
I use overflow: hidden to hide contents which is bigger than the div.
The result now looks like:
I'd like to skip the image which is partly showed.
Like this:
When counter image, skip the whole image.
Then after click the "read more" button, all contents are showed.
How can I done that?
My code:
.post {
width: 800px;
height: 300px;
overflow: hidden;
background-color: #F6F8FA;
border-style: ridge;
border-width: 2px;
border-color: #F6F8FA;
padding: 15px;
margin-bottom: 30px;
margin-left: 5px;
margin-top: 30px;
}
.published-date {
float: right;
}
<div class="post">
<p class="published-date">published: Aug. 29, 2017, 12:19 p.m.</p>
<h1>
<a href="{% url 'post_detail' pk=post.pk %}">
<!--post.title-->
<u>[Django] 預設登入admin</u>
</a>
</h1>
<p>
<!--post.text-->
<p>在Django中,想要新增一個post,但卻還沒登入到admin時,或是admin中沒有你的帳號密碼時,你可能會得到瀏覽器回應這樣的錯誤: </p>
<p><img alt="" src="http://i.imgur.com/4cJUlK7.png?3" />
<br></p>
<p>手動登入admin(localhost:8000/admin)可能可以解決這個問題: </p>
<p><img alt="" src="http://i.imgur.com/Xfbghkx.png" />
<br><br></p>
<p>這時候如果能夠每次都自動登入,就會方便很多。<br /> 而Django在 <code>django.contrib.auth</code> 也提供了一些方法<br /> 以下條件預設登入的user只會有一個(就是我)
<br />
<br> 新增一個 <code>user.py</code> </p>
<div class="codehilite">
<pre><span></span><span class="k">class</span> <span class="nc">UserInfo</span><span class="p">():</span>
<span class="n">username</span> <span class="o">=</span> <span class="p">{</span><span class="n">enter</span> <span class="n">your</span> <span class="n">username</span><span class="p">}</span>
<span class="n">password</span> <span class="o">=</span> <span class="p">{</span><span class="n">enter</span> <span class="n">your</span> <span class="n">password</span><span class="p">}</span>
</pre>
</div>
<p><br> 在 <code>views.py</code> 中,import <code>authenticate</code> , <code>login</code> 。記得也要將自己的user資訊加進來:</p>
<div class="codehilite">
<pre><span></span><span class="kn">from</span> <span class="nn">django.contrib.auth</span> <span class="kn">import</span> <span class="n">authenticate</span><span class="p">,</span> <span class="n">login</span>
<span class="kn">from</span> <span class="nn">.user</span> <span class="kn">import</span> <span class="n">UserInfo</span>
<span class="k">def</span> <span class="nf">post_list</span><span class="p">(</span><span class="n">request</span><span class="p">):</span>
<span class="n">user</span> <span class="o">=</span> <span class="n">authenticate</span><span class="p">(</span><span class="n">username</span> <span class="o">=</span> <span class="n">UserInfo</span><span class="o">.</span><span class="n">username</span><span class="p">,</span> <span class="n">password</span> <span class="o">=</span> <span class="n">UserInfo</span><span class="o">.</span><span class="n">password</span><span class="p">)</span>
<span class="n">login</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">user</span><span class="p">)</span>
<span class="p">{</span><span class="o">...</span><span class="n">your</span> <span class="n">code</span><span class="p">}</span>
</pre>
</div>
<p><br> 在程式執行到 <code>post_list()</code> 的時候就會自動登入,屢試不爽。</p>
<p><br><br> 這樣的寫法把user的帳密分開成一個檔案寫,若要提交到遠端repo,可以直接略過(.gitignore)含有user資訊的檔案,以免公開。
</p>
</p>
<a href="/post/32/"></p>
<a href="{% url 'post_detail' pk=post.pk %}">
<button type="button" class="show-more-btn">more...</button>
</a>
<!--end post.text-->
</div>
post.title and post.text are the title and text content.
You can do this with a jquery function.
$('.show-more-btn').click(function(){
$('.post').animate({height:'100%'}, 500);
});
Basically, once you click on the "more..." button, you add a height:100% to the .post
See the example below.
https://jsfiddle.net/st6ys7tt/9/

Semantic.ui dropdown not working with React.js

I'm trying to use Semantic.ui's dropdown in my Meteor.js + React.js app. Everything else with Semantic.ui works fine, but I can't make the dropdown menu work. Here's my code:
NavigationMain = React.createClass({
componentDidMount() {
$('.ui.dropdown.right').dropdown();
},
componentDidUpdate() {
$('.ui.dropdown.right').dropdown('refresh');
},
_openChat(){
console.log("click");
},
render(){
return (
<div className="ui top attached menu">
<div className="ui dropdown icon item" onClick={this._openChat}>
<i className="comments outline icon"></i>
</div>
<div className="ui dropdown right icon item">
<i className="wrench icon"></i>
<div className="menu">
<div className="item">
<i className="dropdown icon"></i>
<span className="text">New</span>
<div className="menu">
<div className="item">Document</div>
<div className="item">Image</div>
</div>
</div>
<div className="item">
Open...
</div>
<div className="item">
Save...
</div>
<div className="item">Edit Permissions</div>
<div className="divider"></div>
<div className="header">
Export
</div>
<div className="item">
Share...
</div>
</div>
</div>
</div>
);
}
});
I have also tried using Reacts ref attribute to reference the element like this:
$(this.refs.menu).dropdown();
But it doesn't seem to help either.
All the examples I've found, for example the Semantic.ui's official integration doc (http://semantic-ui.com/introduction/integrations.html), work like this and I've made it work before without React. That's why I'm starting to feel helpless.
Any help with this would be appreciated.
Works for me.
var Content = React.createClass({
componentDidMount: function() {
$('.ui.dropdown').dropdown()
},
render: function () {
return <div className="ui dropdown">
<div className="text">File</div>
<i className="dropdown icon" />
<div className="menu">
<div className="item">New</div>
<div className="item">
<span className="description">ctrl + o</span>
Open...
</div>
<div className="item">
<span className="description">ctrl + s</span>
Save as...
</div>
<div className="item">
<span className="description">ctrl + r</span>
Rename
</div>
<div className="item">Make a copy</div>
<div className="item">
<i className="folder icon" />
Move to folder
</div>
<div className="item">
<i className="trash icon" />
Move to trash
</div>
<div className="divider"></div>
<div className="item">Download As...</div>
<div className="item">
<i className="dropdown icon" />
Publish To Web
<div className="menu">
<div className="item">Google Docs</div>
<div className="item">Google Drive</div>
<div className="item">Dropbox</div>
<div className="item">Adobe Creative Cloud</div>
<div className="item">Private FTP</div>
<div className="item">Another Service...</div>
</div>
</div>
<div className="item">E-mail Collaborators</div>
</div>
</div>
}
});
ReactDOM.render(
<Content />,
document.getElementById('container')
);
Here is a fiddle
https://jsfiddle.net/85z7o3n2/

How to prevent page jump when using # href to swap gallery images using a div ID?

I have been struggling with a problem for a while now. I've made a simple html gallery using CSS and a # href to essentially swap out different div ID's containing gallery images. The problem is that when you select the "next" or "previous" buttons in the gallery it jumps the page up in the browser so the gallery is aligned at the top of the page. Does anybody have any ideas how to prevent this?
Here is what the code for the gallery looks like:
<div id="pic1">
<img src="click/pic1.jpg" alt="" />
<a class="previous" href="#pic10"><b>Previous</b></a><a class="next" href="#pic2"><b>Next</b></a>
</div>
<div id="pic2">
<img src="click/pic2.jpg" alt="" />
<a class="previous" href="#pic1"><b>Previous</b></a><a class="next" href="#pic3"> <b>Next</b></a>
</div>
<div id="pic3">
<img src="click/pic3.jpg" alt="" />
<a class="previous" href="#pic2"><b>Previous</b></a><a class="next" href="#pic4"><b>Next</b></a>
</div>
<div id="pic4">
<img src="click/pic4.jpg" alt="" />
<a class="previous" href="#pic3"><b>Previous</b></a><a class="next" href="#pic5"> <b>Next</b></a>
</div>
<div id="pic5">
<img src="click/pic5.jpg" alt="" />
<a class="previous" href="#pic4"><b>Previous</b></a><a class="next" href="#pic6"><b>Next</b></a>
</div>
<div id="pic6">
<img src="click/pic6.jpg" alt="" />
<a class="previous" href="#pic5"><b>Previous</b></a><a class="next" href="#pic7"><b>Next</b></a>
</div>
<div id="pic7">
<img src="click/pic7.jpg" alt="" />
<a class="previous" href="#pic6"><b>Previous</b></a><a class="next" href="#pic8"><b>Next</b></a>
</div>
<div id="pic8">
<img src="click/pic8.jpg" alt="" />
<a class="previous" href="#pic7"><b>Previous</b></a><a class="next" href="#pic9"><b>Next</b></a>
</div>
<div id="pic9">
<img src="click/pic9.jpg" alt="" />
<a class="previous" href="#pic8"><b>Previous</b></a><a class="next" href="#pic10"><b>Next</b></a>
</div>
<div id="pic10">
<img src="click/pic10.jpg" alt="" />
<a class="previous" href="#pic9"><b>Previous</b></a><a class="next" href="#pic1"> <b>Next</b></a>
</div>
Any help would be greatly appreciated!
Instead of linking to #, link to javascript:void(0);
<a class="previous" href="javascript:void(0);">Next</a>
Or, prevent the default event with Javascript
$("a.previous, a.next").on("click", function(e) {
e.preventDefault();
});
You will need to use JQuery after you set
<a class="previous" href="javascript:void(0);">Next</a>
then call the JS:
$(document).ready(function(){
$('a.previous').click(function(e){
var picID= parseInt($(this).parent().attr("id").substr(3));//gets the pic id count
$("#pic"+(picID)).hide(); //hide the current div
$("#pic"+(picID-1)).show(); //show the previous div
});
$('a.next').click(function(e){
var picID= parseInt($(this).parent().attr("id").substr(3)); //gets the pic id count
$("#pic"+(picID)).hide(); //hide the current div
$("#pic"+(picID+1)).show(); //show the previous div
});
});
see: http://jsfiddle.net/uZ6g5/

Resources