I can not click div with the item class on jquery masonry - jquery-masonry

I am using the Masonry. I have the fallowing code after masonry loads the page:
<div id="main_container">
<div id="container" class="masonry" style="position: relative; height: 655px; width: 1128px;">
<div class="item masonry-brick" style="position: absolute; top: 0px; left: 0px;">
<img class="images" src="http://www.elektriklihafifticari.com/ca_images/small/67923429.jpg">
<p class="note"></p>
</div>
<div class="item masonry-brick" style="position: absolute; top: 0px; left: 282px;">
<img class="images" src="http://www.elektriklihafifticari.com/ca_images/small/30446134.jpg">
<p class="note"></p>
</div>
</div>
I want to add a new div to the body as i click on any of these 'item masonry-brick' classes.
And i use the fallowing code to make this:
$(".item.masonry-brick").click(function(){
var body_m=$('body');
var blur_div=$('<div></div>');
blur_div.attr('class','blurred');
body_m.prepend(blur_div);
});
Unfortunately it does not work. I tried many diffrent solutions but could not succeed. I realised that if i change the code as:
$("#container").click(function(){
var body_m=$('body');
var blur_div=$('<div></div>');
blur_div.attr('class','blurred');
body_m.prepend(blur_div);
});
i got what i want as i click on the div with the id=container.
Any ideas?
Thanks.
Edited.
Now there is a new problem about the situation:
the html code is:
<div id="container" class="masonry" style="position: relative; height: 335px; width: 846px;">
<div class="item masonry-brick" style="position: absolute; top: 0px; left: 0px;">
<img class="images" src="http://www.dostahediye.com/ca_images/small/230352553.jpg" data-id="1000014037951491000">
<p class="note">teşekkürler</p>
</div>
<div class="item masonry-brick" style="position: absolute; top: 0px; left: 282px;">
<img class="images" src="http://www.dostahediye.com/ca_images/small/660575147.jpg" data-id="1000014037951491001">
<p class="note">5 kişi lütfen</p>
</div>
<div class="item masonry-brick" style="position: absolute; top: 0px; left: 564px;">
<img class="images" src="http://www.dostahediye.com/ca_images/small/474047220.jpg" data-id="1000014037951491002">
<p class="note">7 kişi lütfen</p>
</div>
When i use the code below to recognise which div.item.masonry-brick is clicked, always the first data-id '1000014037951491000' is alerted.
$("#container").on("click",".item.masonry-brick",function(){
var data_id=$('img',this).data('id');
alert(data_id);
Any ideas?
Thanks in advance.

I guess the .item.masonry-brick elements are added dynamically.
You cannot attach events on dynamically generated elements like this,
Use on instead.
$("#container").on("click",".item.masonry-brick",function(){
var body_m=$('body');
var blur_div=$('<div></div>');
blur_div.addClass('blurred');
body_m.prepend(blur_div);
});

Related

how can i using python senlenium to locate pseudo element

i have below html structure, how can i use python senlenium to locate pseudo element 'before',
<div tabindex="0" data-elemkey="month" data-elemtype="ListBox" data-type="elem" class=" " style="position: absolute; ">
<div style="position: absolute; left: 0px; top: 0px; height: 34px; width: 145px; z-index: 10000;">
<div class="gcell-div font-1669190550589" >
<div class="gcell-div-content v-align-center h-align-left" >
<span class="" style="pointer-events: none; max-height: 100%; max-width: 100%; ">
<i class="common-collapse-down">
::before
i have tried by :
driver.find_element(by=By.CSS_SELECTOR,value='span.listUI-arrow>i')
but because there're many same other 'span.listUI-arrow' elements, so i would like to relation with parent :data-elemkey="month ; how can i get it, thanks

css page-break-after:always works on first page but not on the others.All i want to fill half of all pages

Here is my html:
<div class="rack-label" *ngFor="let product of productsToPrint;let indexOfElement=index;let l=count; " >
// Showing barcodes here
<div *ngIf="(indexOfElement+1)%12==0" class="row-footer">
// And i want to page-break-after works here
// cuz i am showing barcodes
</div>
</div>
`
And here is my css to print page:
#media print {
#page{
margin:3mm 0mm 2mm 3mm;
border: 1px solid red;
/* height: 210mm;
width: 148.5mm; */
size:A4;
margin: 0;
}
html{
border: 1px solid yellow;
}
body
{
width: 210mm;
height: 297mm;
display: grid;
grid-template-columns: 9cm 9cm 9cm;
grid-template-rows:auto auto auto;
}
.row-footer{
clear: both; page-break-before: always;
page-break-inside: avoid;
}
}
Or is there anyway to fix this issue ? Actually all i want to do print 3 col 4 rows barcode to an A5 page.But its not working on ng-print.So i want to do set is as A4 and let space to half of page.
The problem seems to be that absolute positioned elements don't take up any space. Chromium seems to be considering the page essentially blank, so a new page is not necessary.
I've address the issue by giving a minimal size to the relative positioned elements that contain the absolute positioned elements.
I cannot reproduce your example, because I do not know what you are inserting for the barcodes, and your non-printing styles may also be impacting it, but here is an example that produces the problem, and a solution.
Problem, the HTML below will all print on the same page (sometimes, it breaks after first page):
<body style="margin:0">
<div style="position:relative;break-after:page;margin:0;padding:0" >
<div style="width: 57.15mm; height: 30.75mm; position: absolute; overflow: hidden; break-inside: avoid; left: 0mm; top: 0mm;">
1
</div>
</div>
<div style="position:relative;break-after:page;margin:0;padding:0" >
<div style="width: 57.15mm; height: 30.75mm; position: absolute; overflow: hidden; break-inside: avoid; left: 0mm; top: 0mm;">
2
</div>
</div>
<div style="position:relative;break-after:page;margin:0;padding:0" >
<div style="width: 57.15mm; height: 30.75mm; position: absolute; overflow: hidden; break-inside: avoid; left: 0mm; top: 0mm;">
3
</div>
</div>
</body>
The divs with relative positioning are all zero size, and the absolute positioned elements inside of it don't impact the size. Adding a 1mm width and height, gives proper page breaks
<body style="margin:0">
<div style="position:relative;break-after:page;margin:0;padding:0;width:1mm;height:1mm" >
<div style="width: 57.15mm; height: 30.75mm; position: absolute; overflow: hidden; break-inside: avoid; left: 0mm; top: 0mm;">
1
</div>
</div>
<div style="position:relative;break-after:page;margin:0;padding:0;width:1mm;height:1mm" >
<div style="width: 57.15mm; height: 30.75mm; position: absolute; overflow: hidden; break-inside: avoid; left: 0mm; top: 0mm;">
2
</div>
</div>
<div style="position:relative;break-after:page;margin:0;padding:0;width:1mm;height:1mm" >
<div style="width: 57.15mm; height: 30.75mm; position: absolute; overflow: hidden; break-inside: avoid; left: 0mm; top: 0mm;">
3
</div>
</div>
</body>

Applying css to a Web Content Display Portlet in Liferay

I have used Web Content Display Portlet on my page to display some text. I have to apply css and insert some images for those. I have put the html code in the source. HOw do I apply css for it?
Here is the source that will go in my Web Content Display Portlet
<div class="products" style="width:1000px;">
<div class="tvc box">
<img alt="ADVISORY" title="ADVISORY" src="Index_files/ADVISORY.PNG">
<div class="txt">
<p class="hdtxt"><cufon style="width: 78px; height: 16px;" alt="ADVISORY" class="cufon cufon-canvas"><canvas style="width: 85px; height: 16px; top: 1px; left: -1px;" height="16" width="85"></canvas><cufontext>ADVISORY</cufontext></cufon></p>
</div>
Know More </div>
<div class="tvc box">
<img alt="Branch Locator" title="Branch Locator" src="Index_files/branchlocator.jpg">
<div class="txt">
<p class="hdtxt"><cufon style="width: 68px; height: 16px;" alt="BRANCH " class="cufon cufon-canvas"><canvas style="width: 82px; height: 16px; top: 1px; left: -1px;" height="16" width="82"></canvas><cufontext>BRANCH </cufontext></cufon><br><cufon style="width: 73px; height: 16px;" alt="LOCATOR" class="cufon cufon-canvas"><canvas style="width: 80px; height: 16px; top: 1px; left: -1px;" height="16" width="80"></canvas><cufontext>LOCATOR</cufontext></cufon></p>
<p>Use our branch locator to find the branch closest to you!</p>
</div>
Know More </div>
<div class="tvc box">
<img alt="EMI Calculator" title="EMI Calculator" src="Index_files/emicalculator.jpg">
<div class="txt">
<p class="hdtxt"><cufon style="width: 30px; height: 16px;" alt="EMI " class="cufon cufon-canvas"><canvas style="width: 44px; height: 16px; top: 1px; left: -1px;" height="16" width="44"></canvas><cufontext>EMI </cufontext></cufon><br><cufon style="width: 102px; height: 16px;" alt="CALCULATOR" class="cufon cufon-canvas"><canvas style="width: 109px; height: 16px; top: 1px; left: -1px;" height="16" width="109"></canvas><cufontext>CALCULATOR</cufontext></cufon></p>
<p>Knowing your home loan EMI is just a click away!</p>
</div>
Know More </div>
<div class="tvc box">
<img alt="FAQs" title="FAQs" src="Index_files/faqs.jpg">
<div class="txt">
<p class="hdtxt"><cufon style="width: 39px; height: 16px;" alt="FAQs" class="cufon cufon-canvas"><canvas style="width: 48px; height: 16px; top: 1px; left: -1px;" height="16" width="48"></canvas><cufontext>FAQs</cufontext></cufon></p>
<p>Get the answers to frequently asked questions here.</p>
</div>
Know More </div>
</div>
Each div with class "tvc box" has to appear one after another horizontally.
HOw do I apply css for it?
As administrator you can access the look and feel configuration of yout portlet.
Clicking on options icon,and choose Look and Feel.
You can see several tabs:Text styles,Background styles, border styles, advanced styling.
Advanced Styling tab allows you to enter CSS code to customize your portlet.
You can find how to do that in:
http://www.liferay.com/es/documentation/liferay-portal/6.2/user-guide/-/ai/look-and-feel-liferay-portal-6-2-user-guide-04-en
Also you can do a new theme for your site and put there your custom.css (I think is the best option, because you need to put images)
http://www.liferay.com/es/documentation/liferay-portal/6.2/development/-/ai/creating-themes-and-layout-templates-liferay-portal-6-2-dev-guide-09-en

Percentual floating containers inside percentual container

I have a simple problem which i cannot figure out. Look at this html code:
<div id="container">
<div id="content">
<div id="menu">
<ul>
<li>pagina's</li>
<li>home</li>
<li>kamers</li>
<li>over ons</li>
</ul>
</div>
<div class="clearfloats"></div>
<div id="cmscontent">
<div id="sidebar">
<ul>
<li>overzicht van de pagina's</li>
<li class="last">pagina toevoegen</li>
</ul>
</div>
<div id="main">
<h1 class="maintitle">
overzicht van de pagina's
</h1>
<div id="maincontent">
sdfsd
</div>
</div>
<div class="clearfloats"></div>
</div>
</div>
</div>
CSS:
#container {
width: 84%;
margin: 0 auto;
}
#content {
margin-top: 50px;
min-width: 1140px;
}
#cmscontent {
background-color: #ffffff;
border: 1px solid #e0e0e0;
padding: 44px 30px 44px 30px;
position: relative;
z-index: 3;
}
#sidebar{
padding: 14px 24px 14px 24px;
width: 306px;
background-color: #f8f8f8;
float: left;
}
#main {
float: left;
margin-left: 80px;
width: 100%;
}
The problem is that the last container: #main, standard is only as wide as the content it has. So i'm obliged to add a fixed width to it (px). The whole point of my design is that i have floating percentual divs so that's a bummer. Adding 100% width or any other number in %, also has problems of its own..
Is there anyone that a solution for me?
Thank you!
http://www.mathijsdelva.be/cms/
I haven't finetuned anything; i only just html'ed for Safari as of the moment.
The problem is that the last container: #main, standard is only as wide as the content it has.
Tried using display: block for #main ?
What are you actually trying to do here? Are you trying to make a flexible design?

How do I align text/images on bottom/right/center/middle of a container using the blueprint css framework?

Is there some easy way to align stuff in div containers to the right or bottom:
<div class="span-24 align-right last">Text appears on the right side of the layout</div>
or:
<div class="span-2" id="lots-of-content"></div><div class="span-22 last bottom">Appears at bottom of container</div>
or:
<div class="span-24 vertical-middle last">Middle of the container</div>
Here's a sample of what I'm working with trying to position the "topnav" below:
<div class="container">
<div class="span-16">
<h1>Header</h1>
</div>
<div class="span-8 last vertical-middle">
<div id="topnav" class="align-right"><input type="button" id="register" class="ui-button ui-state-default ui-corner-all" value="Register" /> or <button type="button" id="signin" class="ui-button ui-state-default ui-corner-all">Sign in</button></div>
</div>
<hr />
...
</div>
Use position: absolute. For example:
.align-right {
position: absolute;
right: 0;
}
/* Or, alternatively, */
.align-right {
float: right;
}
.bottom {
position: absolute;
bottom: 0;
}
.vertical-middle {
position: absolute;
top: 50%;
}
Note that for vertical-middle, this will center the top edge of the content, no the content itself.
Make sure that the containing DIV is position: relative to force it to become the offset parent (which the position of the children are relative to) EDIT: In other words, add the following rule:
.container {
position: relative;
}

Resources